summaryrefslogtreecommitdiffstats
path: root/fs/proc/proc_sysctl.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-07-20 09:31:35 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-07-20 09:31:35 +0200
commit6bdb486c5a628f7a927c2658166e3a5ef1f883e7 (patch)
tree4b817231c6f48216bc0deff7075c91b6c3ebdf35 /fs/proc/proc_sysctl.c
parentda6d647598a6d182eb6a0344a7b14ae005244399 (diff)
parentba47d845d715a010f7b51f6f89bae32845e6acb7 (diff)
downloadlinux-stable-6bdb486c5a628f7a927c2658166e3a5ef1f883e7.tar.gz
linux-stable-6bdb486c5a628f7a927c2658166e3a5ef1f883e7.tar.bz2
linux-stable-6bdb486c5a628f7a927c2658166e3a5ef1f883e7.zip
Merge 5.8-rc6 into driver-core-next
We need the driver core fixes in here too. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/proc/proc_sysctl.c')
-rw-r--r--fs/proc/proc_sysctl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 42c5128c7d1c..6c1166ccdaea 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -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;