1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Fri, 16 Oct 2020 19:54:49 +0200
3 Subject: [PATCH] mac80211: fix memory leak on filtered powersave frames
5 After the status rework, ieee80211_tx_status_ext is leaking un-acknowledged
6 packets for stations in powersave mode.
7 To fix this, move the code handling those packets from __ieee80211_tx_status
8 into ieee80211_tx_status_ext
10 Reported-by: Tobias Waldvogel <tobias.waldvogel@gmail.com>
11 Fixes: 3318111cf63d ("mac80211: reduce duplication in tx status functions")
12 Signed-off-by: Felix Fietkau <nbd@nbd.name>
15 --- a/net/mac80211/status.c
16 +++ b/net/mac80211/status.c
17 @@ -49,7 +49,8 @@ static void ieee80211_handle_filtered_fr
20 if (info->flags & (IEEE80211_TX_CTL_NO_PS_BUFFER |
21 - IEEE80211_TX_CTL_AMPDU)) {
22 + IEEE80211_TX_CTL_AMPDU |
23 + IEEE80211_TX_CTL_HW_80211_ENCAP)) {
24 ieee80211_free_txskb(&local->hw, skb);
27 @@ -922,15 +923,6 @@ static void __ieee80211_tx_status(struct
28 ieee80211_mpsp_trigger_process(
29 ieee80211_get_qos_ctl(hdr), sta, true, acked);
31 - if (!acked && test_sta_flag(sta, WLAN_STA_PS_STA)) {
33 - * The STA is in power save mode, so assume
34 - * that this TX packet failed because of that.
36 - ieee80211_handle_filtered_frame(local, sta, skb);
40 if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL) &&
41 (ieee80211_is_data(hdr->frame_control)) &&
43 @@ -1157,6 +1149,12 @@ void ieee80211_tx_status_ext(struct ieee
44 -info->status.ack_signal);
46 } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) {
48 + * The STA is in power save mode, so assume
49 + * that this TX packet failed because of that.
52 + ieee80211_handle_filtered_frame(local, sta, skb);
54 } else if (noack_success) {
55 /* nothing to do here, do not account as lost */