From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Kees Cook <kees@kernel.org>, Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Jeff Johnson <jeff.johnson@oss.qualcomm.com>,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] wifi: mac80211: Write cnt before copying in ieee80211_copy_rnr_beacon()
Date: Mon, 21 Jul 2025 12:54:59 -0600 [thread overview]
Message-ID: <331e54f8-f678-41ee-8788-9e91e3f5ff24@embeddedor.com> (raw)
In-Reply-To: <20250721182521.work.540-kees@kernel.org>
On 21/07/25 12:25, Kees Cook wrote:
> 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>
Thanks!
-Gustavo
> ---
> Cc: Johannes Berg <johannes@sipsolutions.net>
> Cc: <linux-wireless@vger.kernel.org>
> ---
> net/mac80211/cfg.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index 4f20d57ab913..2ed07fa121ab 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -1176,13 +1176,13 @@ ieee80211_copy_rnr_beacon(u8 *pos, struct cfg80211_rnr_elems *dst,
> {
> int i, offset = 0;
>
> + dst->cnt = src->cnt;
> for (i = 0; i < src->cnt; i++) {
> memcpy(pos + offset, src->elem[i].data, src->elem[i].len);
> dst->elem[i].len = src->elem[i].len;
> dst->elem[i].data = pos + offset;
> offset += dst->elem[i].len;
> }
> - dst->cnt = src->cnt;
>
> return offset;
> }
prev parent reply other threads:[~2025-07-21 18:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-21 18:25 Kees Cook
2025-07-21 18:54 ` Gustavo A. R. Silva [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=331e54f8-f678-41ee-8788-9e91e3f5ff24@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=gustavoars@kernel.org \
--cc=jeff.johnson@oss.qualcomm.com \
--cc=johannes@sipsolutions.net \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®