فهرست منبع

qcacld-3.0: Prevent NULL pointer dereference on sap_adapter

In hdd_stop_sap_due_to_invalid_channel, sap_adapter is derived using
container_of operation on work structure. It is dereferenced to print
the sessiond id immediately followed by a NULL check.

Move debug print after the NULL check.

Change-Id: Ib22aaeba6d312621e66496fcd646319331305cd2
CRs-Fixed: 2137807
Nachiket Kukade 7 سال پیش
والد
کامیت
6549937aa7
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      core/hdd/src/wlan_hdd_hostapd.c

+ 1 - 1
core/hdd/src/wlan_hdd_hostapd.c

@@ -1498,13 +1498,13 @@ hdd_stop_sap_due_to_invalid_channel(struct work_struct *work)
 	struct hdd_adapter *sap_adapter = container_of(work,
 						  struct hdd_adapter,
 						  sap_stop_bss_work);
-	hdd_debug("work started for sap session[%d]", sap_adapter->session_id);
 	cds_ssr_protect(__func__);
 	if (sap_adapter == NULL) {
 	    cds_err("sap_adapter is NULL, no work needed");
 	    cds_ssr_unprotect(__func__);
 	    return;
 	}
+	hdd_debug("work started for sap session[%d]", sap_adapter->session_id);
 	wlan_hdd_stop_sap(sap_adapter);
 	wlansap_set_invalid_session(WLAN_HDD_GET_SAP_CTX_PTR(sap_adapter));
 	wlansap_cleanup_cac_timer(WLAN_HDD_GET_SAP_CTX_PTR(sap_adapter));