Title: [9112] trunk/drivers/input/touchscreen/ad7160.c: [#6066] AD7160 Linux Driver Support: Safeguard firmware size must not exceed AD7160_MAX_FW_SIZE
Revision
9112
Author
hennerich
Date
2010-08-26 07:51:31 -0400 (Thu, 26 Aug 2010)

Log Message

[#6066] AD7160 Linux Driver Support: Safeguard firmware size must not exceed AD7160_MAX_FW_SIZE

This prevents that the firmware size excluding the header, exceeds the
maximum number of available pages on the AD7160.

Modified Paths

Diff

Modified: trunk/drivers/input/touchscreen/ad7160.c (9111 => 9112)


--- trunk/drivers/input/touchscreen/ad7160.c	2010-08-26 09:52:44 UTC (rev 9111)
+++ trunk/drivers/input/touchscreen/ad7160.c	2010-08-26 11:51:31 UTC (rev 9112)
@@ -833,6 +833,12 @@
 
 	hlenght = le32_to_cpu(header->hlenght);
 
+	if ((fw->size - hlenght) > AD7160_MAX_FW_SIZE) {
+		dev_err(dev, "invalid firmware size (%d)\n", fw->size);
+		ret = -EFAULT;
+		goto out_release_fw;
+	}
+
 	temp = kmalloc(AD7160_MAX_FW_SIZE + AD7160_CMD_HDR_SIZE, GFP_KERNEL);
 	if (temp == NULL) {
 		ret = -ENOMEM;
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to