summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2008-05-15 19:34:16 +0200
committerJonathan Corbet <corbet@lwn.net>2008-06-20 22:05:48 +0200
commit70ffa16e604bab22b12bf72cb7796f1dd01ec335 (patch)
treebd07484ca841d370fb2edb338ad90453431c3b93 /drivers/char
parentlp: cdev lock_kernel() pushdown (diff)
downloadlinux-70ffa16e604bab22b12bf72cb7796f1dd01ec335.tar.xz
linux-70ffa16e604bab22b12bf72cb7796f1dd01ec335.zip
drm: cdev lock_kernel() pushdown
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/drm/drm_fops.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c
index 68f0da801ed8..7a25726f07f7 100644
--- a/drivers/char/drm/drm_fops.c
+++ b/drivers/char/drm/drm_fops.c
@@ -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;
}