From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Mariano Baragiola <mbaragiola@linux.com>
Cc: linux-staging@lists.linux.dev, Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH v3] staging: rtl8723bs: validate monitor transmit frame lengths
Date: Mon, 27 Jul 2026 16:51:41 +0200 [thread overview]
Message-ID: <2026072751-anointer-remorse-943c@gregkh> (raw)
In-Reply-To: <20260717132437.2556215-1-mbaragiola@linux.com>
On Fri, Jul 17, 2026 at 10:24:37AM -0300, Mariano Baragiola wrote:
> rtw_cfg80211_monitor_if_xmit_entry() removes the radiotap header and
> then reads the 802.11 frame control field without checking that a base
> 802.11 header remains.
>
> The data path also pulls the calculated 802.11, QoS and SNAP header
> span before confirming that the skb contains it. A truncated frame can
> therefore cause out-of-bounds reads or leave insufficient data for the
> Ethernet address writes.
>
> Reject frames that do not contain the base 802.11 header and data
> frames that do not contain their complete calculated header span.
>
> Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
> Signed-off-by: Mariano Baragiola <mbaragiola@linux.com>
> ---
> Changes in v3:
> - Add the below-separator changelog as requested by Greg K-H patch-bot.
>
> Changes in v2:
> - Add the Fixes tag as requested by Dan Carpenter.
>
> drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> index 6a97afd89dc7..bed8192ab44f 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> @@ -2033,6 +2033,8 @@ static netdev_tx_t rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struc
>
> /* Skip the ratio tap header */
> skb_pull(skb, rtap_len);
> + if (unlikely(skb->len < dot11_hdr_len))
> + goto fail;
Only ever use likely/unlikely if you can measure the difference of it
not being there. Otherwise the cpu will almost always get it right
instead.
Is that the case here?
>
> dot11_hdr = (struct ieee80211_hdr *)skb->data;
> frame_control = le16_to_cpu(dot11_hdr->frame_control);
> @@ -2045,6 +2047,8 @@ static netdev_tx_t rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struc
> qos_len = 2;
> if ((frame_control & 0x0300) == 0x0300)
> dot11_hdr_len += 6;
> + if (unlikely(skb->len < dot11_hdr_len + qos_len + snap_len))
> + goto fail;
Same here, is this actually measurable?
thanks,
greg k-h
next prev parent reply other threads:[~2026-07-27 14:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 22:59 [PATCH] staging: rtl8723bs: validate monitor transmit frame lengths Mariano Baragiola
2026-07-17 11:50 ` Dan Carpenter
2026-07-17 13:03 ` [PATCH v2] " Mariano Baragiola
2026-07-17 13:16 ` Greg Kroah-Hartman
2026-07-17 13:24 ` [PATCH v3] " Mariano Baragiola
2026-07-27 14:51 ` Greg Kroah-Hartman [this message]
2026-07-27 16:08 ` [PATCH v4] " Mariano Baragiola
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=2026072751-anointer-remorse-943c@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=error27@gmail.com \
--cc=linux-staging@lists.linux.dev \
--cc=mbaragiola@linux.com \
/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