summaryrefslogtreecommitdiffstats
path: root/drivers/uio
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2008-05-15 18:39:37 +0200
committerJonathan Corbet <corbet@lwn.net>2008-06-20 22:05:47 +0200
commitfbc8a81d66bbbce3f0b4d5752f8bc8bb3c1fc439 (patch)
tree7a96eba56ea94a4b2a6ce95f4ad4d8ced0960ed9 /drivers/uio
parentInput: cdev lock_kernel() pushdown (diff)
downloadlinux-fbc8a81d66bbbce3f0b4d5752f8bc8bb3c1fc439.tar.xz
linux-fbc8a81d66bbbce3f0b4d5752f8bc8bb3c1fc439.zip
UIO: cdev lock_kernel() pushdown
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'drivers/uio')
-rw-r--r--drivers/uio/uio.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 55cc7b80422a..1a0415e77a30 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -297,12 +297,17 @@ static int uio_open(struct inode *inode, struct file *filep)
struct uio_listener *listener;
int ret = 0;
+ lock_kernel();
idev = idr_find(&uio_idr, iminor(inode));
- if (!idev)
- return -ENODEV;
+ if (!idev) {
+ ret = -ENODEV;
+ goto out;
+ }
- if (!try_module_get(idev->owner))
- return -ENODEV;
+ if (!try_module_get(idev->owner)) {
+ ret = -ENODEV;
+ goto out;
+ }
listener = kmalloc(sizeof(*listener), GFP_KERNEL);
if (!listener) {
@@ -319,7 +324,7 @@ static int uio_open(struct inode *inode, struct file *filep)
if (ret)
goto err_infoopen;
}
-
+ unlock_kernel();
return 0;
err_infoopen:
@@ -329,6 +334,8 @@ err_alloc_listener:
module_put(idev->owner);
+out:
+ unlock_kernel();
return ret;
}