2007-03-25 23:18:44

by Daniel Drake

[permalink] [raw]
Subject: [PATCH] zd1211rw-mac80211: Fix NULL dereference on installer exit path

When dealing with a DEVICE_INSTALLER, dev will be NULL when disconnect()
is called. This fixes a NULL dereference oops with such devices.

Signed-off-by: Daniel Drake <[email protected]>
---
drivers/net/wireless/mac80211/zd1211rw/zd_usb.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mac80211/zd1211rw/zd_usb.c b/drivers/net/wireless/mac80211/zd1211rw/zd_usb.c
index 8867110..24d22dc 100644
--- a/drivers/net/wireless/mac80211/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/mac80211/zd1211rw/zd_usb.c
@@ -978,14 +978,17 @@ error:
static void disconnect(struct usb_interface *intf)
{
struct ieee80211_hw *dev = zd_intf_to_dev(intf);
- struct zd_mac *mac = zd_dev_mac(dev);
- struct zd_usb *usb = &mac->chip.usb;
+ struct zd_mac *mac;
+ struct zd_usb *usb;

/* Either something really bad happened, or we're just dealing with
* a DEVICE_INSTALLER. */
if (dev == NULL)
return;

+ mac = zd_dev_mac(dev);
+ usb = &mac->chip.usb;
+
dev_dbg_f(zd_usb_dev(usb), "\n");

ieee80211_unregister_hw(dev);
--
1.5.0.5