Skip to contentSkip to conversation

staging: rtl8712: Fix a possible NULL pointer dereference in function r8712_joinbss_event_callback

PATCH New Lee Gibson 1 participant 1 message Mar 19, 2021 Staging

lore
Share & tools
lore

Lee Gibson

author
#0 lore raw

PATCH 1/1 staging: rtl8712: Fix a possible NULL pointer dereference in function r8712_joinbss_event_callback

GCC 10 analyzer reports a warning: dereference of NULL
The function r8712_find_network can return NULL and is usually checked but no check is present is this case.
Fix by adding the check.

---
 drivers/staging/rtl8712/rtl871x_mlme.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/rtl8712/rtl871x_mlme.c +2 -1
index 6074383ec0b5..f5886b39b3b5 100644
@@ -728,7 +728,8 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
 					     r8712_find_network(&pmlmepriv->
 					     scanned_queue,
 					     cur_network->network.MacAddress);
-					pcur_wlan->fixed = false;
+					if (pcur_wlan)
+						pcur_wlan->fixed = false;
 
 					pcur_sta = r8712_get_stainfo(pstapriv,
 					     cur_network->network.MacAddress);
Signature · 1 line
2.25.1