From: Michael Buesch Date: Sat, 1 Aug 2009 15:04:19 +0000 (-0300) Subject: thinkpad-acpi: restrict procfs count value to sane upper limit X-Git-Tag: v5.15~32937^2~4^2~1 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=5b05d4696d38c3172e79e855cc1e2ed044589508;p=mirror_ubuntu-kernels.git thinkpad-acpi: restrict procfs count value to sane upper limit Signed-off-by: Michael Buesch Acked-by: Henrique de Moraes Holschuh Signed-off-by: Len Brown --- diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 27d68e719e90..18f9ee63c50a 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -766,6 +766,8 @@ static int dispatch_procfs_write(struct file *file, if (!ibm || !ibm->write) return -EINVAL; + if (count > PAGE_SIZE - 2) + return -EINVAL; kernbuf = kmalloc(count + 2, GFP_KERNEL); if (!kernbuf)