two more fixes for sysctl
Subsystems (4)
Hi Al,
two more fixes for the kernel pointers in the sysctl handlers.
PATCH 1/2 cdrom: fix an incorrect __user annotation on cdrom_sysctl_info
No user pointers for sysctls anymore.
Fixes 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
Reported-by build test robot <[email protected]>
Signed-off-by Christoph Hellwig <[email protected]>
--- drivers/cdrom/cdrom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cdrom/cdrom.c +1 -1
@@ -3518,7 +3518,7 @@ static int cdrom_print_info(const char *header, int val, char *info, }static int cdrom_sysctl_info (struct ctl_table *ctl,int write, -void __user *buffer,size_t *lenp,loff_t *ppos) +void *buffer,size_t *lenp,loff_t *ppos) {int pos;char *info = cdrom_sysctl_settings.info;
Signature · 1 line
2.26.2
PATCH 2/2 sysctl: reject gigantic reads/write to sysctl files
In reply to Christoph HellwigInstead of triggering a WARN_ON deep down in the page allocator just give up early on allocations that are way larger than the usual sysctl values.
Fixes 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
Reported-by Vegard Nossum <[email protected]>
Signed-off-by Christoph Hellwig <[email protected]>
--- fs/proc/proc_sysctl.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/proc/proc_sysctl.c +4 -0
@@ -564,6 +564,10 @@ static ssize_t proc_sys_call_handler(struct file *filp, void __user *ubuf,if (!table->proc_handler) goto out; +/* don't even try if the size is too large */ +if (count >KMALLOC_MAX_SIZE ) +return -ENOMEM ; +if (write) { kbuf =memdup_user_nul (ubuf, count);if (IS_ERR (kbuf)) {
Signature · 1 line
2.26.2
Luis Chamberlain
Acked-byQuoted 3 lines · Christoph Hellwig
Hi Al,
two more fixes for the kernel pointers in the sysctl handlers.
Acked-by Luis Chamberlain <[email protected]>
Luis
Al Viro
maintainerQuoted 3 lines · Christoph Hellwig
Hi Al,
two more fixes for the kernel pointers in the sysctl handlers.
Applied and pushed. Let me beat it up a bit, if it survives - to Linus it goes...