mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
SUNRPC/cache: add module_put() on error path in cache_open()
If kmalloc() fails in cache_open(), module cd->owner left locked. The patch adds module_put(cd->owner) on this path. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
This commit is contained in:
parent
ff7c4b3693
commit
a7823c797b
1 changed files with 3 additions and 1 deletions
|
|
@ -986,8 +986,10 @@ static int cache_open(struct inode *inode, struct file *filp,
|
|||
nonseekable_open(inode, filp);
|
||||
if (filp->f_mode & FMODE_READ) {
|
||||
rp = kmalloc(sizeof(*rp), GFP_KERNEL);
|
||||
if (!rp)
|
||||
if (!rp) {
|
||||
module_put(cd->owner);
|
||||
return -ENOMEM;
|
||||
}
|
||||
rp->offset = 0;
|
||||
rp->q.reader = 1;
|
||||
atomic_inc(&cd->readers);
|
||||
|
|
|
|||
Loading…
Reference in a new issue