]> err.no Git - linux-2.6/commitdiff
drm: cdev lock_kernel() pushdown
authorJonathan Corbet <corbet@lwn.net>
Thu, 15 May 2008 17:34:16 +0000 (11:34 -0600)
committerJonathan Corbet <corbet@lwn.net>
Fri, 20 Jun 2008 20:05:48 +0000 (14:05 -0600)
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
drivers/char/drm/drm_fops.c

index 68f0da801ed82b579efc5fcc3a94c6b755536f1c..7a25726f07f7962bb8185dee4d23679ab7e2d255 100644 (file)
@@ -37,6 +37,7 @@
 #include "drmP.h"
 #include "drm_sarea.h"
 #include <linux/poll.h>
+#include <linux/smp_lock.h>
 
 static int drm_open_helper(struct inode *inode, struct file *filp,
                           struct drm_device * dev);
@@ -174,12 +175,14 @@ int drm_stub_open(struct inode *inode, struct file *filp)
 
        DRM_DEBUG("\n");
 
+       /* BKL pushdown: note that nothing else serializes idr_find() */
+       lock_kernel();
        minor = idr_find(&drm_minors_idr, minor_id);
        if (!minor)
-               return -ENODEV;
+               goto out;
 
        if (!(dev = minor->dev))
-               return -ENODEV;
+               goto out;
 
        old_fops = filp->f_op;
        filp->f_op = fops_get(&dev->driver->fops);
@@ -189,6 +192,8 @@ int drm_stub_open(struct inode *inode, struct file *filp)
        }
        fops_put(old_fops);
 
+out:
+       unlock_kernel();
        return err;
 }