Skip to content

Commit d2b1e1a

Browse files
committed
wifi: mt76: do not free skb on ieee80211_tx_prepare_skb failure
ieee80211_tx_prepare_skb already frees the skb internally when invoke_tx_handlers fails, so freeing it again in the caller leads to a double-free / NULL pointer dereference in skb_release_data. Signed-off-by: Felix Fietkau <nbd@nbd.name>
1 parent ab6abc9 commit d2b1e1a

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

mac80211.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,10 +2168,8 @@ mt76_offchannel_send_nullfunc(struct mt76_offchannel_cb_data *data,
21682168

21692169
if (!ieee80211_tx_prepare_skb(phy->hw, vif, skb,
21702170
phy->main_chandef.chan->band,
2171-
&sta)) {
2172-
ieee80211_free_txskb(phy->hw, skb);
2171+
&sta))
21732172
return;
2174-
}
21752173

21762174
if (sta)
21772175
wcid = (struct mt76_wcid *)sta->drv_priv;

scan.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,8 @@ mt76_scan_send_probe(struct mt76_dev *dev, struct cfg80211_ssid *ssid)
6969

7070
rcu_read_lock();
7171

72-
if (!ieee80211_tx_prepare_skb(phy->hw, vif, skb, band, NULL)) {
73-
ieee80211_free_txskb(phy->hw, skb);
72+
if (!ieee80211_tx_prepare_skb(phy->hw, vif, skb, band, NULL))
7473
goto out;
75-
}
7674

7775
info = IEEE80211_SKB_CB(skb);
7876
if (req->no_cck)

0 commit comments

Comments
 (0)