]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
wifi: mac80211: Write cnt before copying in ieee80211_copy_rnr_beacon()
authorKees Cook <kees@kernel.org>
Mon, 21 Jul 2025 18:25:22 +0000 (11:25 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 10:08:49 +0000 (12:08 +0200)
commitbf88b7c114d496cb6a26797f23087e6b01ce61fe
tree6a09fb295f06d7ef0994802ce1e1606daec23a56
parent50e98be435dfc35164d03265a3b64d0aa00bf67b
wifi: mac80211: Write cnt before copying in ieee80211_copy_rnr_beacon()

[ Upstream commit a37192c432adaec9e8ef29e4ddb319ea2f443aa6 ]

While I caught the need for setting cnt early in nl80211_parse_rnr_elems()
in the original annotation of struct cfg80211_rnr_elems with __counted_by,
I missed a similar pattern in ieee80211_copy_rnr_beacon(). Fix this by
moving the cnt assignment to before the loop.

Fixes: 7b6d7087031b ("wifi: cfg80211: Annotate struct cfg80211_rnr_elems with __counted_by")
Signed-off-by: Kees Cook <kees@kernel.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://patch.msgid.link/20250721182521.work.540-kees@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/mac80211/cfg.c