mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 04:12:04 -04:00
UPSTREAM: Call sysctl_head_finish on error
This error path returned directly instead of calling sysctl_head_finish().
Fixes: ef9d965bc8b6 ("sysctl: reject gigantic reads/write to sysctl files")
Change-Id: I0ed6a48f20b1eeed5485839334460c49629c7ed1
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
9ea12f49c9
commit
e9c817b9d8
1 changed files with 3 additions and 3 deletions
|
|
@ -599,8 +599,9 @@ static ssize_t proc_sys_call_handler(struct file *filp, void __user *ubuf,
|
|||
goto out;
|
||||
|
||||
/* don't even try if the size is too large */
|
||||
if (count > KMALLOC_MAX_SIZE)
|
||||
return -ENOMEM;
|
||||
error = -ENOMEM;
|
||||
if (count >= KMALLOC_MAX_SIZE)
|
||||
goto out;
|
||||
|
||||
if (write) {
|
||||
kbuf = memdup_user_nul(ubuf, count);
|
||||
|
|
@ -609,7 +610,6 @@ static ssize_t proc_sys_call_handler(struct file *filp, void __user *ubuf,
|
|||
goto out;
|
||||
}
|
||||
} else {
|
||||
error = -ENOMEM;
|
||||
kbuf = kzalloc(count, GFP_KERNEL);
|
||||
if (!kbuf)
|
||||
goto out;
|
||||
|
|
|
|||
Loading…
Reference in a new issue