drm: fix locking in gem debugfs/procfs file
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 8 Aug 2013 13:41:33 +0000 (15:41 +0200)
committerDave Airlie <airlied@redhat.com>
Mon, 19 Aug 2013 04:16:47 +0000 (14:16 +1000)
The idr is protected with our spinlock, if we don't hold that nothing
prevents the gem objects from disappearing from under us.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_info.c

index d4b20ceda3fbd8d183dc7e628683732590200f51..9f8fc4c328c9fea7d344bc9cfe3e5aee1016d160 100644 (file)
@@ -218,7 +218,11 @@ int drm_gem_name_info(struct seq_file *m, void *data)
        struct drm_device *dev = node->minor->dev;
 
        seq_printf(m, "  name     size handles refcount\n");
+
+       spin_lock(&dev->object_name_lock);
        idr_for_each(&dev->object_name_idr, drm_gem_one_name_info, m);
+       spin_unlock(&dev->object_name_lock);
+
        return 0;
 }