[PATCH] libertas: don't oops on module unload after boot2 flash
Dan Williams
dcbw at redhat.com
Thu Nov 2 18:09:42 EST 2006
Commit: 09715e97a1cdd66a98acf020618cb7005464d0df
Parent: 4f88d17dc9788341f4d62c808c148609a27afb55
commit 09715e97a1cdd66a98acf020618cb7005464d0df
Author: Dan Williams <dcbw at redhat.com>
AuthorDate: Thu Nov 2 18:04:18 2006 -0200
Commit: Marcelo Tosatti <mtosatti at redhat.com>
CommitDate: Thu Nov 2 18:04:18 2006 -0200
[PATCH] libertas: don't oops on module unload after boot2 flash
if_usb_disconnect() was attempting to grab and dereference the usb
device private data, which under normal operation is a pointer to the
wlan_private structure for the card. Under Boot2 operation, that
pointer is NULL because the card hasn't been set up for normal
operation. The attached patch fixes this oops.
Signed-off-by: Dan Williams <dcbw at redhat.com>
---
drivers/net/wireless/libertas/if_usb.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 7bf979a..27818a9 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -359,17 +359,22 @@ static void if_usb_disconnect(struct usb
{
struct usb_card_rec *cardp = usb_get_intfdata(intf);
wlan_private *priv = (wlan_private *) cardp->priv;
- wlan_adapter *Adapter = priv->adapter;
+ wlan_adapter *Adapter = NULL;
ENTER();
#ifdef SUPPORT_BOOT_COMMAND
if (UpdateStorage.u8DriverFunctionActive != DRIVER_NORMAL) {
us_usb_disconnect(intf);
- LEAVE();
- return ;
+ goto out;
}
#endif
+
+ /* priv will only be allocated during normal operation,
+ * but NOT doing a Boot2 firmware update.
+ */
+ Adapter = priv->adapter;
+
/*
* Update Surprie removed to TRUE
* Free all the URB's allocated
@@ -388,6 +393,7 @@ #endif
usb_set_intfdata(intf, NULL);
usb_put_dev(interface_to_usbdev(intf));
+out:
LEAVE();
return;
}
More information about the Commits-kernel
mailing list