mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
drm: Protect dev->filelist with its own mutex
amdgpu gained dev->struct_mutex usage, and that's because it's walking the dev->filelist list. Protect that list with it's own lock to take one more step towards getting rid of struct_mutex usage in drivers once and for all. While doing the conversion I noticed that 2 debugfs files in i915 completely lacked appropriate locking. Fix that up too. v2: don't forget to switch to drm_gem_object_unreference_unlocked. Cc: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1461691808-12414-9-git-send-email-daniel.vetter@ffwll.ch
This commit is contained in:
@@ -297,9 +297,9 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
|
||||
}
|
||||
mutex_unlock(&dev->master_mutex);
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
mutex_lock(&dev->filelist_mutex);
|
||||
list_add(&priv->lhead, &dev->filelist);
|
||||
mutex_unlock(&dev->struct_mutex);
|
||||
mutex_unlock(&dev->filelist_mutex);
|
||||
|
||||
#ifdef __alpha__
|
||||
/*
|
||||
@@ -447,8 +447,11 @@ int drm_release(struct inode *inode, struct file *filp)
|
||||
|
||||
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
mutex_lock(&dev->filelist_mutex);
|
||||
list_del(&file_priv->lhead);
|
||||
mutex_unlock(&dev->filelist_mutex);
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
if (file_priv->magic)
|
||||
idr_remove(&file_priv->master->magic_map, file_priv->magic);
|
||||
mutex_unlock(&dev->struct_mutex);
|
||||
|
||||
Reference in New Issue
Block a user