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-Url: https://git.stricted.de/?a=commitdiff_plain;h=5b05d4696d38c3172e79e855cc1e2ed044589508;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.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 27d68e719e9..18f9ee63c50 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)