From: Christian Lamparter <chunkeey@gmail.com>
To: Wang Yan <wangyan01@kylinos.cn>
Cc: johannes.berg@intel.com, 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, 6 Sep 2026 13:06:15 +0200 [thread overview]
Message-ID: <bdca394f-0371-45ad-bfee-b044444ad724@gmail.com> (raw)
In-Reply-To: <20260903081200.267514-1-wangyan01@kylinos.cn>
On 9/3/26 10:12 AM, Wang Yan wrote:
> In p54_find_ie(), mgmt is a pointer to struct ieee80211_mgmt, so
> sizeof(mgmt) evaluates to the size of the pointer rather than the size
> of the management frame header.
>
> Use sizeof(*mgmt) instead so that the skb length is compared against
> the actual size of the management frame header.
>
> Fixes: 0ac0d6cedf61 ("p54: Move mac80211 glue code")
It's older than that. I traced it back to:
Fixes: e5ea92a7528d ("p54: AP & Ad-hoc testing")
> Signed-off-by: Wang Yan <wangyan01@kylinos.cn>
> ---
> drivers/net/wireless/intersil/p54/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/intersil/p54/main.c b/drivers/net/wireless/intersil/p54/main.c
> index 57a62108cbc3..d3e1776174f9 100644
> --- a/drivers/net/wireless/intersil/p54/main.c
> +++ b/drivers/net/wireless/intersil/p54/main.c
> @@ -76,7 +76,7 @@ u8 *p54_find_ie(struct sk_buff *skb, u8 ie)
> struct ieee80211_mgmt *mgmt = (void *)skb->data;
> u8 *pos, *end;
>
> - if (skb->len <= sizeof(mgmt))
> + if (skb->len <= sizeof(*mgmt))
> return NULL;
In theory this check is actually superfluous. Reason being the rest of the code of this function:
| 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.
So:
Acked-by: Christian Lamparter <chunkeey@gmail.com>
That said, if you want to respin and remove this check, I would also ack it.
next prev parent reply other threads:[~2026-09-06 11:06 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 [this message]
2026-09-06 11:49 ` Johannes Berg
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=bdca394f-0371-45ad-bfee-b044444ad724@gmail.com \
--to=chunkeey@gmail.com \
--cc=johannes.berg@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.