Patch for crash in pci_remove_behind_bridge()

Pavel Roskin proski at gnu.org
Mon Apr 14 16:49:29 BST 2003


Hello!

I mentioned yesterday that the port of plx9052 driver to Linux 2.5.x
crashes when the card is manually removed.  In fact if was an
understatement.  "cardctl eject" would have the same effect.

Here's the patch:

=============================
--- linux.orig/drivers/pcmcia/cardbus.c
+++ linux/drivers/pcmcia/cardbus.c
@@ -270,5 +270,6 @@ void cb_free(socket_info_t * s)
 {
 	struct pci_dev *bridge = s->cap.cb_dev;

-	pci_remove_behind_bridge(bridge);
+	if (bridge)
+		pci_remove_behind_bridge(bridge);
 }
=============================

cb_free() is called from shutdown_socket() regardless of whether the
socket supports CardBus.  plx9052 sets cb_dev to NULL in its capabilities.
So pci_remove_behind_bridge() is called on NULL and crashes.

All other drivers not capable of supporting CardBus are affected if
CardBus support is enabled.

Let me know if I should post this patch to LKML.

-- 
Regards,
Pavel Roskin



More information about the linux-pcmcia mailing list