[PATCH] EFI missing failure handling

From: Panagiotis Issaris
Date: Sat Mar 05 2005 - 10:47:20 EST


Hi,

The EFI driver allocates memory and writes into it without checking the
success of the allocation:

668 efi_char16_t *variable_name = kmalloc(1024, GFP_KERNEL);
...
696 memset(variable_name, 0, 1024);

The patch applies to 2.6.11-bk1.

Signed-off-by: Panagiotis Issaris <panagiotis.issaris@xxxxxxxxxxxxxxxxxxx>

diff -pruN linux-2.6.11-orig/drivers/firmware/efivars.c linux-2.6.11-pi/drivers/firmware/efivars.c
--- linux-2.6.11-orig/drivers/firmware/efivars.c 2005-03-05 02:23:29.000000000 +0100
+++ linux-2.6.11-pi/drivers/firmware/efivars.c 2005-03-05 02:23:04.000000000 +0100
@@ -670,6 +670,9 @@ efivars_init(void)
unsigned long variable_name_size = 1024;
int i, rc = 0, error = 0;

+ if (!variable_name)
+ return -ENOMEM;
+
if (!efi_enabled)
return -ENODEV;

--
K.U.Leuven, Mechanical Eng., Mechatronics & Robotics Research Group
http://people.mech.kuleuven.ac.be/~pissaris/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/