Commit 0b7b9b6c authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman
Browse files

staging: wilc1000: fix NULL dereference inside wilc_scan()



Added NULL check before accessing 'hidden_net' pointer inside
wilc_scan() to fix the issue found by static code checker.

Fixes: 8f1a0ac1 ("staging: wilc1000: handle scan operation callback from cfg80211 context")
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2da56630
Loading
Loading
Loading
Loading
+26 −22
Original line number Diff line number Diff line
@@ -246,6 +246,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,

	hif_drv->usr_scan_req.ch_cnt = 0;

	if (hidden_net) {
		wid_list[index].id = WID_SSID_PROBE_REQ;
		wid_list[index].type = WID_STR;

@@ -268,6 +269,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
			wid_list[index].size = (s32)(valuesize + 1);
			index++;
		}
	}

	wid_list[index].id = WID_INFO_ELEMENT_PROBE;
	wid_list[index].type = WID_BIN_DATA;
@@ -316,8 +318,10 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
		  jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT));

error:
	if (hidden_net) {
		kfree(hidden_net->net_info);
		kfree(hdn_ntwk_wid_val);
	}

	return result;
}