Browse Source

qcacld-3.0: Add check to validate vdev id

Set ARP stats command is sent to firmware after
SAP is stopped. As a result, invalid vdev id is
sent in the set ARP stats param resulting in
firmware crash.

Fix is to add check to validate vdev id before
sending set ARP stats command to firmware.

Change-Id: Ia7ab56b9d5aa6a0fd53d84ef1264feea395dd44c
CRs-Fixed: 2149289
Yeshwanth Sriram Guntuka 7 years ago
parent
commit
d5aae7fcf4

+ 5 - 0
core/hdd/src/wlan_hdd_cfg80211.c

@@ -11581,6 +11581,11 @@ static int __wlan_hdd_cfg80211_set_nud_stats(struct wiphy *wiphy,
 		return err;
 	}
 
+	if (adapter->session_id == HDD_SESSION_ID_INVALID) {
+		hdd_err("Invalid session id");
+		return -EINVAL;
+	}
+
 	if (tb[STATS_SET_START]) {
 		if (!tb[STATS_GW_IPV4]) {
 			QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,

+ 9 - 0
core/wma/inc/wma_internal.h

@@ -1369,4 +1369,13 @@ struct wma_beacon_interval_reset_req {
  */
 int wma_fill_beacon_interval_reset_req(tp_wma_handle wma, uint8_t vdev_id,
 				uint16_t beacon_interval, uint32_t timeout);
+/*
+ * wma_is_vdev_valid() - check the vdev status
+ * @vdev_id: vdev identifier
+ *
+ * This function verifies the vdev validity
+ *
+ * Return: 'true' on valid vdev else 'false'
+ */
+bool wma_is_vdev_valid(uint32_t vdev_id);
 #endif

+ 1 - 1
core/wma/src/wma_dev_if.c

@@ -1145,7 +1145,7 @@ int wma_vdev_start_resp_handler(void *handle, uint8_t *cmd_param_info,
 	return 0;
 }
 
-static bool wma_is_vdev_valid(uint32_t vdev_id)
+bool wma_is_vdev_valid(uint32_t vdev_id)
 {
 	tp_wma_handle wma_handle = cds_get_context(QDF_MODULE_ID_WMA);
 

+ 4 - 0
core/wma/src/wma_main.c

@@ -6955,6 +6955,10 @@ static void wma_set_arp_req_stats(WMA_HANDLE handle,
 			 __func__);
 		return;
 	}
+	if (!wma_is_vdev_valid(req_buf->vdev_id)) {
+		WMA_LOGE("vdev id not active or not valid");
+		return;
+	}
 
 	arp_stats = (struct set_arp_stats *)req_buf;
 	status = wmi_unified_set_arp_stats_req(wma_handle->wmi_handle,