public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] staging: rtl8723bs: fix null dereference in find_network
@ 2026-02-02  6:38 Ethan Tidmore
  2026-02-02  8:38 ` Dan Carpenter
  2026-02-02  8:38 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Ethan Tidmore @ 2026-02-02  6:38 UTC (permalink / raw)
  To: gregkh, straube.linux
  Cc: dan.carpenter, hansg, linux-staging, linux-kernel, Ethan Tidmore,
	stable

The pwlan variable has the possibility of returning NULL and is not
checked for NULL and then later dereferenced.

Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
Cc: stable@vger.kernel.org
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index f81a29cd6a78..29dd0b56223a 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -835,8 +835,11 @@ static void find_network(struct adapter *adapter)
 	struct wlan_network *tgt_network = &pmlmepriv->cur_network;
 
 	pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.mac_address);
-	if (pwlan)
-		pwlan->fixed = false;
+
+	if (!pwlan)
+		return;
+
+	pwlan->fixed = false;
 
 	if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) &&
 	    (adapter->stapriv.asoc_sta_count == 1))
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] staging: rtl8723bs: fix null dereference in find_network
  2026-02-02  6:38 [PATCH v1] staging: rtl8723bs: fix null dereference in find_network Ethan Tidmore
@ 2026-02-02  8:38 ` Dan Carpenter
  2026-02-02  8:38 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2026-02-02  8:38 UTC (permalink / raw)
  To: Ethan Tidmore
  Cc: gregkh, straube.linux, hansg, linux-staging, linux-kernel, stable

On Mon, Feb 02, 2026 at 12:38:08AM -0600, Ethan Tidmore wrote:
> The pwlan variable has the possibility of returning NULL and is not
> checked for NULL and then later dereferenced.
> 
> Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_mlme.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> index f81a29cd6a78..29dd0b56223a 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> @@ -835,8 +835,11 @@ static void find_network(struct adapter *adapter)
>  	struct wlan_network *tgt_network = &pmlmepriv->cur_network;
>  
>  	pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.mac_address);
> -	if (pwlan)
> -		pwlan->fixed = false;
> +

Delete this blank line.

regards,
dan carpenter

> +	if (!pwlan)
> +		return;
> +
> +	pwlan->fixed = false;
>  
>  	if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) &&
>  	    (adapter->stapriv.asoc_sta_count == 1))
> -- 
> 2.52.0
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] staging: rtl8723bs: fix null dereference in find_network
  2026-02-02  6:38 [PATCH v1] staging: rtl8723bs: fix null dereference in find_network Ethan Tidmore
  2026-02-02  8:38 ` Dan Carpenter
@ 2026-02-02  8:38 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2026-02-02  8:38 UTC (permalink / raw)
  To: Ethan Tidmore
  Cc: straube.linux, dan.carpenter, hansg, linux-staging, linux-kernel,
	stable

On Mon, Feb 02, 2026 at 12:38:08AM -0600, Ethan Tidmore wrote:
> The pwlan variable has the possibility of returning NULL and is not
> checked for NULL and then later dereferenced.

dereferenced where?  Not in this function :)

Please be more specific as to what exactly you are fixing here.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-02  8:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-02  6:38 [PATCH v1] staging: rtl8723bs: fix null dereference in find_network Ethan Tidmore
2026-02-02  8:38 ` Dan Carpenter
2026-02-02  8:38 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox