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: v3.0~8298^2~4^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5b05d4696d38c3172e79e855cc1e2ed044589508;p=platform%2Fkernel%2Flinux-amlogic.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 27d68e7..18f9ee6 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)