aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-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