Skip to content

Commit 1d18288

Browse files
nbd168jmberg-intel
authored andcommitted
mac80211: fix memory leak on filtered powersave frames
After the status rework, ieee80211_tx_status_ext is leaking un-acknowledged packets for stations in powersave mode. To fix this, move the code handling those packets from __ieee80211_tx_status into ieee80211_tx_status_ext Reported-by: Tobias Waldvogel <[email protected]> Fixes: 3318111 ("mac80211: reduce duplication in tx status functions") Signed-off-by: Felix Fietkau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent 94e2bd0 commit 1d18288

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

net/mac80211/status.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,
4949
int ac;
5050

5151
if (info->flags & (IEEE80211_TX_CTL_NO_PS_BUFFER |
52-
IEEE80211_TX_CTL_AMPDU)) {
52+
IEEE80211_TX_CTL_AMPDU |
53+
IEEE80211_TX_CTL_HW_80211_ENCAP)) {
5354
ieee80211_free_txskb(&local->hw, skb);
5455
return;
5556
}
@@ -915,15 +916,6 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,
915916
ieee80211_mpsp_trigger_process(
916917
ieee80211_get_qos_ctl(hdr), sta, true, acked);
917918

918-
if (!acked && test_sta_flag(sta, WLAN_STA_PS_STA)) {
919-
/*
920-
* The STA is in power save mode, so assume
921-
* that this TX packet failed because of that.
922-
*/
923-
ieee80211_handle_filtered_frame(local, sta, skb);
924-
return;
925-
}
926-
927919
if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL) &&
928920
(ieee80211_is_data(hdr->frame_control)) &&
929921
(rates_idx != -1))
@@ -1150,6 +1142,12 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
11501142
-info->status.ack_signal);
11511143
}
11521144
} else if (test_sta_flag(sta, WLAN_STA_PS_STA)) {
1145+
/*
1146+
* The STA is in power save mode, so assume
1147+
* that this TX packet failed because of that.
1148+
*/
1149+
if (skb)
1150+
ieee80211_handle_filtered_frame(local, sta, skb);
11531151
return;
11541152
} else if (noack_success) {
11551153
/* nothing to do here, do not account as lost */

0 commit comments

Comments
 (0)