Skip to content

Commit 8b082a4

Browse files
committed
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull sysctl fix from Al Viro: "Another regression fix for sysctl changes this cycle..." * 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: Call sysctl_head_finish on error
2 parents b8e516b + d4d80e6 commit 8b082a4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/proc/proc_sysctl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,9 @@ static ssize_t proc_sys_call_handler(struct file *filp, void __user *ubuf,
566566
goto out;
567567

568568
/* don't even try if the size is too large */
569-
if (count > KMALLOC_MAX_SIZE)
570-
return -ENOMEM;
569+
error = -ENOMEM;
570+
if (count >= KMALLOC_MAX_SIZE)
571+
goto out;
571572

572573
if (write) {
573574
kbuf = memdup_user_nul(ubuf, count);
@@ -576,7 +577,6 @@ static ssize_t proc_sys_call_handler(struct file *filp, void __user *ubuf,
576577
goto out;
577578
}
578579
} else {
579-
error = -ENOMEM;
580580
kbuf = kzalloc(count, GFP_KERNEL);
581581
if (!kbuf)
582582
goto out;

0 commit comments

Comments
 (0)