From: Johannes Berg <johannes@sipsolutions.net>
To: Christian Lamparter <chunkeey@gmail.com>,
Wang Yan <wangyan01@kylinos.cn>
Cc: zilin@seu.edu.cn, linville@tuxdriver.com,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] wifi: p54: fix incorrect frame length check in p54_find_ie()
Date: Sun, 06 Sep 2026 13:49:27 +0200 [thread overview]
Message-ID: <087d18429b448d5b63f922fd6779925f827134c7.camel@sipsolutions.net> (raw)
In-Reply-To: <bdca394f-0371-45ad-bfee-b044444ad724@gmail.com>
On Sun, 2026-09-06 at 13:06 +0200, Christian Lamparter wrote:
>
> > pos = (u8 *)mgmt->u.beacon.variable;
> > end = skb->data + skb->len;
> > while (pos < end) {
> > if (pos + 2 + pos[1] > end)
> > return NULL;
> >
> > if (pos[0] == ie)
> > return pos;
> >
> > pos += 2 + pos[1];
> > }
> > return NULL;
>
> The check in the while loop and the checks within the while loop make sure that
> no "pos" is returned unless the IE is still within skb->len.
>
> But true, it should have been *mgmt and not mgmt.
FWIW, I dropped it because it really shouldn't have been there this way
since 'mgmt' can be far bigger than needed since it contains the union
for all kinds of action frames etc.
I'm not even sure it's needed regardless of the next check since the
beacon is built by mac80211.
Just blindly patching one mistake for another doesn't help anyone.
johannes
next prev parent reply other threads:[~2026-09-06 11:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 8:12 [PATCH] wifi: p54: fix incorrect frame length check in p54_find_ie() Wang Yan
2026-09-06 11:06 ` Christian Lamparter
2026-09-06 11:49 ` Johannes Berg [this message]
2026-09-06 14:24 ` Christian Lamparter
2026-09-06 14:44 ` Johannes Berg
2026-09-07 2:49 ` [PATCH v2] wifi: p54: remove redundant " Wang Yan
2026-09-07 6:19 ` [PATCH] wifi: p54: fix incorrect " Wang Yan
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=087d18429b448d5b63f922fd6779925f827134c7.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=chunkeey@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=wangyan01@kylinos.cn \
--cc=zilin@seu.edu.cn \
/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