All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Muhammad Bilal <meatuni001@gmail.com>
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH 5/5] staging: rtl8723bs: fix skb->len underflow in monitor TX path
Date: Tue, 28 Jul 2026 09:43:26 +0200	[thread overview]
Message-ID: <2026072855-protrude-limes-4f11@gregkh> (raw)
In-Reply-To: <20260718190212.64409-1-meatuni001@gmail.com>

On Sun, Jul 19, 2026 at 12:02:12AM +0500, Muhammad Bilal wrote:
> rtw_cfg80211_monitor_if_xmit_entry() strips a radiotap header with
> skb_pull(skb, rtap_len), then immediately dereferences the 802.11
> header fields (frame_control, addr1, addr2) without checking that
> skb->len is still large enough to contain a struct ieee80211_hdr
> (24 bytes).
> 
> Further down, it calls:
> 
> 	skb_pull(skb, dot11_hdr_len + qos_len + snap_len -
> 			sizeof(src_mac_addr) * 2);
> 
> again with no check that skb->len covers this amount first. Plain
> skb_pull() does not itself validate the requested length against
> skb->len; on a too-short injected frame this makes skb->len
> underflow to a huge unsigned value, after which skb->data and the
> following memcpy()s operate on a corrupted skb.
> 
> This function is reachable by writing a raw frame to a monitor-mode
> network device, which does not require elevated privileges beyond
> being able to create/use a monitor-mode interface (CAP_NET_RAW).
> 
> Add explicit skb->len checks before dereferencing the 802.11 header
> and before each skb_pull(), bailing out via the existing "fail"
> error path on any mismatch.
> 
> Fixes: 554c0a3abf216 ("staging: Add rtl8723bs sdio wifi driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
> ---
>  drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> index 6a97afd89dc7..eac1b6ac4c67 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> @@ -2034,10 +2034,15 @@ 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 < sizeof(struct ieee80211_hdr)))
> +		goto fail;

Unless you can prove that unlikely() provides better performance, please
do not do this.

Let me go revert all of these and wait for a new series.

thanks,

greg k-h

  reply	other threads:[~2026-07-28  7:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-18 18:54 [PATCH 0/5] staging: rtl8723bs: fix multiple OOB reads in IE and frame parsing Muhammad Bilal
2026-07-18 18:54 ` [PATCH 1/5] staging: rtl8723bs: fix OOB read in rtw_get_wps_ie() Muhammad Bilal
2026-07-28  7:40   ` Greg Kroah-Hartman
2026-07-18 18:54 ` [PATCH 2/5] staging: rtl8723bs: fix OOB read / stack overflow in rtw_get_wps_attr() Muhammad Bilal
2026-07-18 18:54 ` [PATCH 3/5] staging: rtl8723bs: fix OOB read in rtw_action_frame_parse() Muhammad Bilal
2026-07-18 18:54 ` [PATCH 4/5] staging: rtl8723bs: fix OOB read in rtw_restruct_wmm_ie() Muhammad Bilal
2026-07-18 19:02 ` [PATCH 5/5] staging: rtl8723bs: fix skb->len underflow in monitor TX path Muhammad Bilal
2026-07-28  7:43   ` Greg Kroah-Hartman [this message]
2026-07-19  5:18 ` [PATCH 0/5] staging: rtl8723bs: fix multiple OOB reads in IE and frame parsing Greg Kroah-Hartman

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=2026072855-protrude-limes-4f11@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=meatuni001@gmail.com \
    --cc=stable@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 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.