mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
UIO: cdev lock_kernel() pushdown
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
parent
2edbf8537e
commit
fbc8a81d66
1 changed files with 12 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue