Commit 77b6b2e0 authored by Dmitry Antipov's avatar Dmitry Antipov Committed by Wen Zhiwei
Browse files

wifi: mac80211: free skb on error path in ieee80211_beacon_get_ap()

stable inclusion
from stable-v6.6.53
commit 9902dacd5b0bfad3f52ff9bf306ae9d46340bba4
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAZ0GM

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=9902dacd5b0bfad3f52ff9bf306ae9d46340bba4



--------------------------------

[ 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: default avatarDmitry Antipov <dmantipov@yandex.ru>
Link: https://patch.msgid.link/20240805142035.227847-1-dmantipov@yandex.ru


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent 43d57cd8
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);