Skip to contentSkip to conversation

zd1211rw: Do not panic on device eject when associated

PATCH In review Jouni Malinen 3 participants 3 messages Mar 16, 2009 – Mar 17, 2009 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 zd1211rw: Do not panic on device eject when associated

zd_op_tx() must not return an arbitrary error value since that can leave mac80211 trying to retransmit the frame and with the extra data pushed into the beginning of the skb on every attempt, this will end up causing a kernel panic (skb_under_panic from skb_push call). This can happen, e.g., when ejecting the device when associated.

---
 drivers/net/wireless/zd1211rw/zd_mac.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/wireless/zd1211rw/zd_mac.c +6 -2
@@ -575,13 +575,17 @@ static int zd_op_tx(struct ieee80211_hw 
 
 	r = fill_ctrlset(mac, skb);
 	if (r)
-		return r;
+		goto fail;
 
 	info->rate_driver_data[0] = hw;
 
 	r = zd_usb_tx(&mac->chip.usb, skb);
 	if (r)
-		return r;
+		goto fail;
+	return 0;
+
+fail:
+	dev_kfree_skb(skb);
 	return 0;
 }
 
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
maintainer
#2 lore raw
In reply to Jouni Malinen
Quoted 7 lines · Jouni Malinen

zd_op_tx() must not return an arbitrary error value since that can leave mac80211 trying to retransmit the frame and with the extra data pushed into the beginning of the skb on every attempt, this will end up causing a kernel panic (skb_under_panic from skb_push call). This can happen, e.g., when ejecting the device when associated.

Should be for the various stable versions too. All of them, most likely.

johannes

Quoted 27 lines
---
 drivers/net/wireless/zd1211rw/zd_mac.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/wireless/zd1211rw/zd_mac.c +6 -2
@@ -575,13 +575,17 @@ static int zd_op_tx(struct ieee80211_hw 
 
 	r = fill_ctrlset(mac, skb);
 	if (r)
-		return r;
+		goto fail;
 
 	info->rate_driver_data[0] = hw;
 
 	r = zd_usb_tx(&mac->chip.usb, skb);
 	if (r)
-		return r;
+		goto fail;
+	return 0;
+
+fail:
+	dev_kfree_skb(skb);
 	return 0;
 }