PCI: fix an oops in some pci devices on hotplug remove when their resources are being freed.

From: Greg KH
Date: Fri Apr 01 2005 - 19:51:31 EST


ChangeSet 1.2181.16.7, 2005/03/17 10:30:46-08:00, gregkh@xxxxxxx

PCI: fix an oops in some pci devices on hotplug remove when their resources are being freed.

As reported by Prarit Bhargava <prarit@xxxxxxx>

Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>


drivers/pci/remove.c | 2 +-
kernel/resource.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)


diff -Nru a/drivers/pci/remove.c b/drivers/pci/remove.c
--- a/drivers/pci/remove.c 2005-04-01 15:37:58 -08:00
+++ b/drivers/pci/remove.c 2005-04-01 15:37:58 -08:00
@@ -19,7 +19,7 @@
pci_cleanup_rom(dev);
for (i = 0; i < PCI_NUM_RESOURCES; i++) {
struct resource *res = dev->resource + i;
- if (res->parent)
+ if (res && res->parent)
release_resource(res);
}
}
diff -Nru a/kernel/resource.c b/kernel/resource.c
--- a/kernel/resource.c 2005-04-01 15:37:58 -08:00
+++ b/kernel/resource.c 2005-04-01 15:37:58 -08:00
@@ -505,6 +505,7 @@
*p = res->sibling;
write_unlock(&resource_lock);
kfree(res);
+ res = NULL;
return;
}
p = &res->sibling;

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