]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: mac80211: free skb on error path in ieee80211_beacon_get_ap()
authorDmitry Antipov <dmantipov@yandex.ru>
Mon, 5 Aug 2024 14:20:35 +0000 (17:20 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 Sep 2024 14:25:10 +0000 (16:25 +0200)
[ Upstream commit 786c5be9ac29a39b6f37f1fdd2ea59d0fe35d525 ]

In 'ieee80211_beacon_get_ap()', free allocated skb in case of error
returned by 'ieee80211_beacon_protect()'. Compile tested only.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Link: https://patch.msgid.link/20240805142035.227847-1-dmantipov@yandex.ru
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/mac80211/tx.c

index 46b02a6ae0a368a0f8c8c548582a15e2b419ac86..415e951e4138a545bf15fd3ed04e82e760ea973f 100644 (file)
@@ -5311,8 +5311,10 @@ ieee80211_beacon_get_ap(struct ieee80211_hw *hw,
        if (beacon->tail)
                skb_put_data(skb, beacon->tail, beacon->tail_len);
 
-       if (ieee80211_beacon_protect(skb, local, sdata, link) < 0)
+       if (ieee80211_beacon_protect(skb, local, sdata, link) < 0) {
+               dev_kfree_skb(skb);
                return NULL;
+       }
 
        ieee80211_beacon_get_finish(hw, vif, link, offs, beacon, skb,
                                    chanctx_conf, csa_off_base);