All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Salman Alghamdi <me@cipherat.com>
Cc: straube.linux@gmail.com, error27@gmail.com, luka.gejak@linux.dev,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 1/7] staging: rtl8723bs: rtw_mlme: add bounds checks before ie_length subtraction
Date: Mon, 11 May 2026 10:08:07 +0200	[thread overview]
Message-ID: <2026051143-armadillo-outline-d8b2@gregkh> (raw)
In-Reply-To: <20260508222725.24075-2-me@cipherat.com>

On Sat, May 09, 2026 at 01:26:57AM +0300, Salman Alghamdi wrote:
> Add guards to ensure ie_length is large enough before subtracting
> fixed IE offsets to prevent unsigned integer underflow.
> 
> Signed-off-by: Salman Alghamdi <me@cipherat.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_mlme.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> index 268f294528e6..9f21a2226dbd 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> @@ -604,6 +604,8 @@ static bool rtw_is_desired_network(struct adapter *adapter, struct wlan_network
>  	privacy = pnetwork->network.privacy;
>  
>  	if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) {
> +		if (pnetwork->network.ie_length < _FIXED_IE_LENGTH_)
> +			return false;
>  		if (rtw_get_wps_ie(pnetwork->network.ies + _FIXED_IE_LENGTH_, pnetwork->network.ie_length - _FIXED_IE_LENGTH_, NULL, &wps_ielen))
>  			return true;
>  		else
> @@ -617,11 +619,15 @@ static bool rtw_is_desired_network(struct adapter *adapter, struct wlan_network
>  			bselected = false;
>  
>  		if (psecuritypriv->ndisauthtype == Ndis802_11AuthModeWPA2PSK) {
> -			p = rtw_get_ie(pnetwork->network.ies + _BEACON_IE_OFFSET_, WLAN_EID_RSN, &ie_len, (pnetwork->network.ie_length - _BEACON_IE_OFFSET_));
> -			if (p && ie_len > 0)
> -				bselected = true;
> -			else
> +			if (pnetwork->network.ie_length < _BEACON_IE_OFFSET_) {
>  				bselected = false;
> +			} else {
> +				p = rtw_get_ie(pnetwork->network.ies + _BEACON_IE_OFFSET_, WLAN_EID_RSN, &ie_len, (pnetwork->network.ie_length - _BEACON_IE_OFFSET_));
> +				if (p && ie_len > 0)
> +					bselected = true;
> +				else
> +					bselected = false;
> +			}
>  		}
>  	}
>  
> -- 
> 2.54.0
> 
> 

Doesn't this fix a real bug here and should be backported to stable
kernels?  If so, can you send this as a separate patch removed from this
series?

thanks,

greg k-h

  reply	other threads:[~2026-05-11  8:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08 22:26 [PATCH v7 0/7] staging: rtl8723bs: rtw_mlme: line length cleanup Salman Alghamdi
2026-05-08 22:26 ` [PATCH v7 1/7] staging: rtl8723bs: rtw_mlme: add bounds checks before ie_length subtraction Salman Alghamdi
2026-05-11  8:08   ` Greg KH [this message]
2026-05-08 22:26 ` [PATCH v7 2/7] staging: rtl8723bs: rtw_mlme: wrap lines exceeding 100 columns Salman Alghamdi
2026-05-08 22:26 ` [PATCH v7 3/7] staging: rtl8723bs: rtw_mlme: wrap rtw_sitesurvey_cmd condition Salman Alghamdi
2026-05-08 22:27 ` [PATCH v7 4/7] staging: rtl8723bs: rtw_mlme: extract local variables for long expressions Salman Alghamdi
2026-05-08 22:27 ` [PATCH v7 5/7] staging: rtl8723bs: rtw_mlme: remove dead commented-out code Salman Alghamdi
2026-05-08 22:27 ` [PATCH v7 6/7] staging: rtl8723bs: rtw_mlme: consolidate capability comparisons lines Salman Alghamdi
2026-05-08 22:27 ` [PATCH v7 7/7] staging: rtl8723bs: rtw_mlme: add blank line for readability Salman Alghamdi
2026-05-11  8:08 ` [PATCH v7 0/7] staging: rtl8723bs: rtw_mlme: line length cleanup Greg KH

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=2026051143-armadillo-outline-d8b2@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=error27@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=luka.gejak@linux.dev \
    --cc=me@cipherat.com \
    --cc=straube.linux@gmail.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 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.