aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uio
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2008-05-15 12:39:37 -0400
committerJonathan Corbet <corbet@lwn.net>2008-06-20 16:05:47 -0400
commitfbc8a81d66bbbce3f0b4d5752f8bc8bb3c1fc439 (patch)
tree7a96eba56ea94a4b2a6ce95f4ad4d8ced0960ed9 /drivers/uio
parent2edbf8537edc62c9b0ef75e7025d01e8b6a48707 (diff)
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)
297 struct uio_listener *listener; 297 struct uio_listener *listener;
298 int ret = 0; 298 int ret = 0;
299 299
300 lock_kernel();
300 idev = idr_find(&uio_idr, iminor(inode)); 301 idev = idr_find(&uio_idr, iminor(inode));
301 if (!idev) 302 if (!idev) {
302 return -ENODEV; 303 ret = -ENODEV;
304 goto out;
305 }
303 306
304 if (!try_module_get(idev->owner)) 307 if (!try_module_get(idev->owner)) {
305 return -ENODEV; 308 ret = -ENODEV;
309 goto out;
310 }
306 311
307 listener = kmalloc(sizeof(*listener), GFP_KERNEL); 312 listener = kmalloc(sizeof(*listener), GFP_KERNEL);
308 if (!listener) { 313 if (!listener) {
@@ -319,7 +324,7 @@ static int uio_open(struct inode *inode, struct file *filep)
319 if (ret) 324 if (ret)
320 goto err_infoopen; 325 goto err_infoopen;
321 } 326 }
322 327 unlock_kernel();
323 return 0; 328 return 0;
324 329
325err_infoopen: 330err_infoopen:
@@ -329,6 +334,8 @@ err_alloc_listener:
329 334
330 module_put(idev->owner); 335 module_put(idev->owner);
331 336
337out:
338 unlock_kernel();
332 return ret; 339 return ret;
333} 340}
334 341