Ver Fonte

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 há 16 anos atrás
pai
commit
5b05d4696d
1 ficheiros alterados com 2 adições e 0 exclusões
  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)