staging: rtl8723bs: fix null dereference in find_network
Subsystems (2)
PATCH 1/1 staging: rtl8723bs: fix null dereference in find_network
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")
Signed-off-by Ethan Tidmore <[email protected]>
--- drivers/staging/rtl8723bs/core/rtw_mlme.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme.c +5 -2
@@ -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 ))
Signature · 1 line
2.52.0
Quoted 15 lines · Ethan Tidmore
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")Signed-off-by Ethan Tidmore <[email protected]>--- drivers/staging/rtl8723bs/core/rtw_mlme.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/staging/rtl8723bs/core/rtw_mlme.c +0
-0
drivers/staging/rtl8723bs/core/rtw_mlme.c static void find_network(struct adapter *adapter) · line 838
Quoted 6 lines
drivers/staging/rtl8723bs/core/rtw_mlme.c +1
-2@@ -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
Quoted 10 lines
drivers/staging/rtl8723bs/core/rtw_mlme.c +4
-0+if (!pwlan) +return ; + + pwlan->fixed = false;if (check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE ) && (adapter->stapriv.asoc_sta_count ==1 ))Signature · 1 line
2.52.0
Greg KH
maintainerQuoted 2 lines · Ethan Tidmore
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