]> git.ipfire.org Git - thirdparty/linux.git/commit
wifi: mac80211: always free skb on ieee80211_tx_prepare_skb() failure
authorFelix Fietkau <nbd@nbd.name>
Sat, 14 Mar 2026 06:54:55 +0000 (06:54 +0000)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 18 Mar 2026 08:09:58 +0000 (09:09 +0100)
commitd5ad6ab61cbd89afdb60881f6274f74328af3ee9
tree22de5814a918b183cf4d9014f73547ce41ccc5be
parentdeb353d9bb009638b7762cae2d0b6e8fdbb41a69
wifi: mac80211: always free skb on ieee80211_tx_prepare_skb() failure

ieee80211_tx_prepare_skb() has three error paths, but only two of them
free the skb. The first error path (ieee80211_tx_prepare() returning
TX_DROP) does not free it, while invoke_tx_handlers() failure and the
fragmentation check both do.

Add kfree_skb() to the first error path so all three are consistent,
and remove the now-redundant frees in callers (ath9k, mt76,
mac80211_hwsim) to avoid double-free.

Document the skb ownership guarantee in the function's kdoc.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://patch.msgid.link/20260314065455.2462900-1-nbd@nbd.name
Fixes: 06be6b149f7e ("mac80211: add ieee80211_tx_prepare_skb() helper function")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/ath/ath9k/channel.c
drivers/net/wireless/mediatek/mt76/scan.c
drivers/net/wireless/virtual/mac80211_hwsim.c
include/net/mac80211.h
net/mac80211/tx.c