Browse Source

qcacmn: Fix KWork issues in Scan component

Fix KWork issues (NULL pointer checks, pointer dereference)
in scan path

Change-Id: I1c66a99bbfc69202d24f288ccfbebd2811345ded
CRs-Fixed: 2160771
gaurank kathpalia 7 years ago
parent
commit
98d3395e7a
2 changed files with 35 additions and 8 deletions
  1. 9 0
      umac/scan/core/src/wlan_scan_filter.c
  2. 26 8
      umac/scan/core/src/wlan_scan_manager.c

+ 9 - 0
umac/scan/core/src/wlan_scan_filter.c

@@ -158,6 +158,9 @@ static bool scm_is_wep_security(struct scan_filter *filter,
 	enum wlan_auth_type neg_auth = WLAN_AUTH_TYPE_OPEN_SYSTEM;
 	enum wlan_enc_type neg_mccipher = WLAN_ENCRYPT_TYPE_NONE;
 
+	if (!security)
+		return false;
+
 	/* If privacy bit is not set, consider no match */
 	if (!db_entry->cap_info.wlan_caps.privacy)
 		return false;
@@ -311,6 +314,8 @@ static bool scm_is_rsn_security(struct scan_filter *filter,
 	struct wlan_rsn_ie rsn = {0};
 	QDF_STATUS status;
 
+	if (!security)
+		return false;
 	if (!util_scan_entry_rsn(db_entry))
 		return false;
 	status = wlan_parse_rsn_ie(util_scan_entry_rsn(db_entry), &rsn);
@@ -554,6 +559,8 @@ static bool scm_is_wpa_security(struct scan_filter *filter,
 	enum wlan_enc_type neg_mccipher = WLAN_ENCRYPT_TYPE_NONE;
 	struct wlan_wpa_ie wpa = {0};
 
+	if (!security)
+		return false;
 	if (!util_scan_entry_wpa(db_entry))
 		return false;
 
@@ -653,6 +660,8 @@ static bool scm_is_wapi_security(struct scan_filter *filter,
 	enum wlan_enc_type neg_mccipher = WLAN_ENCRYPT_TYPE_NONE;
 	struct wlan_wapi_ie wapi = {0};
 
+	if (!security)
+		return false;
 	if (!util_scan_entry_wapi(db_entry))
 		return false;
 

+ 26 - 8
umac/scan/core/src/wlan_scan_manager.c

@@ -301,13 +301,13 @@ scm_scan_serialize_callback(struct wlan_serialization_command *cmd,
 	QDF_STATUS status;
 
 	if (!cmd) {
-		scm_err("cmd: %pK, reason: %d", cmd, reason);
+		scm_err("cmd is NULL, reason: %d", reason);
 		QDF_ASSERT(0);
 		return QDF_STATUS_E_NULL_VALUE;
 	}
 
 	if (!cmd->umac_cmd) {
-		scm_err("umac_cmd: %pK, reason: %d", cmd->umac_cmd, reason);
+		scm_err("cmd->umac_cmd is NULL , reason: %d", reason);
 		QDF_ASSERT(0);
 		return QDF_STATUS_E_NULL_VALUE;
 	}
@@ -374,8 +374,14 @@ scm_scan_start_req(struct scheduler_msg *msg)
 	struct wlan_objmgr_psoc *psoc;
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 
-	if (!msg || !msg->bodyptr) {
-		scm_err("msg or msg->bodyptr is NULL");
+	if (!msg) {
+		scm_err("msg received is NULL");
+		QDF_ASSERT(0);
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+	if (!msg->bodyptr) {
+		scm_err("bodyptr is NULL");
+		QDF_ASSERT(0);
 		return QDF_STATUS_E_NULL_VALUE;
 	}
 
@@ -477,8 +483,14 @@ scm_scan_cancel_req(struct scheduler_msg *msg)
 	struct scan_cancel_request *req;
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 
-	if (!msg || !msg->bodyptr) {
-		scm_err("msg or msg->bodyptr is NULL");
+	if (!msg) {
+		scm_err("msg received is NULL");
+		QDF_ASSERT(0);
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+	if (!msg->bodyptr) {
+		scm_err("Bodyptr is NULL");
+		QDF_ASSERT(0);
 		return QDF_STATUS_E_NULL_VALUE;
 	}
 
@@ -658,8 +670,14 @@ scm_scan_event_handler(struct scheduler_msg *msg)
 	struct scan_start_request *scan_start_req;
 	struct wlan_scan_obj *scan;
 
-	if (!msg || !msg->bodyptr) {
-		scm_err("msg or msg->bodyptr is NULL");
+	if (!msg) {
+		scm_err("NULL msg received ");
+		QDF_ASSERT(0);
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+	if (!msg->bodyptr) {
+		scm_err("NULL scan event received");
+		QDF_ASSERT(0);
 		return QDF_STATUS_E_NULL_VALUE;
 	}