[2.6 patch] drivers/block/DAC960.c: fix a use after free

From: Adrian Bunk
Date: Wed Mar 23 2005 - 20:15:48 EST


This patch fixes a use after free found by the Coverity checker.

Controller is used in the Failure path.

In the Failure patch, Controller will be freed in the end, so this kfree
can simply be deleted.

Signed-off-by: Adrian Bunk <bunk@xxxxxxxxx>

--- linux-2.6.12-rc1-mm1-full/drivers/block/DAC960.c.old 2005-03-23 03:35:40.000000000 +0100
+++ linux-2.6.12-rc1-mm1-full/drivers/block/DAC960.c 2005-03-23 03:38:10.000000000 +0100
@@ -2700,10 +2700,8 @@
Controller->PCIDevice = PCI_Device;
strcpy(Controller->FullModelName, "DAC960");

- if (pci_enable_device(PCI_Device)) {
- kfree(Controller);
+ if (pci_enable_device(PCI_Device))
goto Failure;
- }

switch (Controller->HardwareType)
{

-
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/