Commit fbc8a81d authored by Jonathan Corbet's avatar Jonathan Corbet

UIO: cdev lock_kernel() pushdown

Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 2edbf853
...@@ -297,12 +297,17 @@ static int uio_open(struct inode *inode, struct file *filep) ...@@ -297,12 +297,17 @@ static int uio_open(struct inode *inode, struct file *filep)
struct uio_listener *listener; struct uio_listener *listener;
int ret = 0; int ret = 0;
lock_kernel();
idev = idr_find(&uio_idr, iminor(inode)); idev = idr_find(&uio_idr, iminor(inode));
if (!idev) if (!idev) {
return -ENODEV; ret = -ENODEV;
goto out;
}
if (!try_module_get(idev->owner)) if (!try_module_get(idev->owner)) {
return -ENODEV; ret = -ENODEV;
goto out;
}
listener = kmalloc(sizeof(*listener), GFP_KERNEL); listener = kmalloc(sizeof(*listener), GFP_KERNEL);
if (!listener) { if (!listener) {
...@@ -319,7 +324,7 @@ static int uio_open(struct inode *inode, struct file *filep) ...@@ -319,7 +324,7 @@ static int uio_open(struct inode *inode, struct file *filep)
if (ret) if (ret)
goto err_infoopen; goto err_infoopen;
} }
unlock_kernel();
return 0; return 0;
err_infoopen: err_infoopen:
...@@ -329,6 +334,8 @@ static int uio_open(struct inode *inode, struct file *filep) ...@@ -329,6 +334,8 @@ static int uio_open(struct inode *inode, struct file *filep)
module_put(idev->owner); module_put(idev->owner);
out:
unlock_kernel();
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment