Explorar o código

thinkpad-acpi: restrict procfs count value to sane upper limit

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
Michael Buesch %!s(int64=16) %!d(string=hai) anos
pai
achega
5b05d4696d
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      drivers/platform/x86/thinkpad_acpi.c

+ 2 - 0
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)