1
0
Fork 0

Call sysctl_head_finish on error

This error path returned directly instead of calling sysctl_head_finish().

Fixes: ef9d965bc8 ("sysctl: reject gigantic reads/write to sysctl files")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
alistair/sunxi64-5.8
Matthew Wilcox (Oracle) 2020-07-03 14:10:14 -04:00 committed by Al Viro
parent b3a9e3b962
commit d4d80e6992
1 changed files with 3 additions and 3 deletions

View File

@ -566,8 +566,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);
@ -576,7 +577,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;