Skip to content

Commit

Permalink
drm/bochs: Don't grab dev->struct_mutex for in mmap offset ioctl
Browse files Browse the repository at this point in the history
Since David Herrmann's mmap vma manager rework we don't need to grab
dev->struct_mutex any more to prevent races when looking up the mmap
offset. Drop it and instead don't forget to use the unref_unlocked
variant (since the drm core still cares).

Reviewed-by: Thierry Reding <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
  • Loading branch information
danvet committed Aug 10, 2015
1 parent a66b2ea commit 37ae75c
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions drivers/gpu/drm/bochs/bochs_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,25 +454,17 @@ int bochs_dumb_mmap_offset(struct drm_file *file, struct drm_device *dev,
uint32_t handle, uint64_t *offset)
{
struct drm_gem_object *obj;
int ret;
struct bochs_bo *bo;

mutex_lock(&dev->struct_mutex);
obj = drm_gem_object_lookup(dev, file, handle);
if (obj == NULL) {
ret = -ENOENT;
goto out_unlock;
}
if (obj == NULL)
return -ENOENT;

bo = gem_to_bochs_bo(obj);
*offset = bochs_bo_mmap_offset(bo);

drm_gem_object_unreference(obj);
ret = 0;
out_unlock:
mutex_unlock(&dev->struct_mutex);
return ret;

drm_gem_object_unreference_unlocked(obj);
return 0;
}

/* ---------------------------------------------------------------------- */
Expand Down

0 comments on commit 37ae75c

Please sign in to comment.