From: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx> Move the locking out of etnaviv_gem_mmap_offset() into its solitary caller, and take the mutex using mutex_lock_interruptible(). This allows etnaviv_ioctl_gem_info() to handle signals while trying to obtain this lock. Signed-off-by: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx> --- drivers/staging/etnaviv/etnaviv_drv.c | 7 ++++++- drivers/staging/etnaviv/etnaviv_gem.c | 7 ++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/etnaviv/etnaviv_drv.c b/drivers/staging/etnaviv/etnaviv_drv.c index 9962318075c5..a87de2e79fee 100644 --- a/drivers/staging/etnaviv/etnaviv_drv.c +++ b/drivers/staging/etnaviv/etnaviv_drv.c @@ -447,7 +447,12 @@ static int etnaviv_ioctl_gem_info(struct drm_device *dev, void *data, if (!obj) return -ENOENT; - ret = etnaviv_gem_mmap_offset(obj, &args->offset); + ret = mutex_lock_interruptible(&dev->struct_mutex); + if (ret == 0) { + ret = etnaviv_gem_mmap_offset(obj, &args->offset); + + mutex_unlock(&dev->struct_mutex); + } drm_gem_object_unreference_unlocked(obj); diff --git a/drivers/staging/etnaviv/etnaviv_gem.c b/drivers/staging/etnaviv/etnaviv_gem.c index 38dee80d996c..b1984a4ac0c5 100644 --- a/drivers/staging/etnaviv/etnaviv_gem.c +++ b/drivers/staging/etnaviv/etnaviv_gem.c @@ -269,20 +269,17 @@ out: } } -/** get mmap offset */ +/* get mmap offset - must be called under struct_mutex */ int etnaviv_gem_mmap_offset(struct drm_gem_object *obj, uint64_t *offset) { - struct drm_device *dev = obj->dev; int ret; - mutex_lock(&dev->struct_mutex); /* Make it mmapable */ ret = drm_gem_create_mmap_offset(obj); if (ret) - dev_err(dev->dev, "could not allocate mmap offset\n"); + dev_err(obj->dev->dev, "could not allocate mmap offset\n"); else *offset = drm_vma_node_offset_addr(&obj->vma_node); - mutex_unlock(&dev->struct_mutex); return ret; } -- 2.5.1 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel