Ver Fonte

qcacld-3.0: Fix cm req accessed outside cm req or CM lock

Caller of wlan_cm_get_rnr, uses the cm request data without
lock.

Fix it by passing a local memory to wlan_cm_get_rnr to get
a copied data to use.

Change-Id: I574de5391dd02c1603e7c9c4b79b58d45e6e7739
CRs-Fixed: 3483870
Abhishek Singh há 1 ano atrás
pai
commit
6d513e3e0d

+ 18 - 10
components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_api.c

@@ -2363,14 +2363,17 @@ QDF_STATUS wlan_get_chan_by_bssid_from_rnr(struct wlan_objmgr_vdev *vdev,
 {
 	struct reduced_neighbor_report *rnr;
 	int i;
+	QDF_STATUS status;
 
 	*chan = 0;
+	rnr = qdf_mem_malloc(sizeof(*rnr));
+	if (!rnr)
+		return QDF_STATUS_E_NOMEM;
 
-	rnr = wlan_cm_get_rnr(vdev, cm_id);
-
-	if (!rnr) {
-		mlme_err("no rnr IE is gotten");
-		return QDF_STATUS_E_EMPTY;
+	status = wlan_cm_get_rnr(vdev, cm_id, rnr);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		qdf_mem_free(rnr);
+		return status;
 	}
 
 	for (i = 0; i < MAX_RNR_BSS; i++) {
@@ -2382,6 +2385,7 @@ QDF_STATUS wlan_get_chan_by_bssid_from_rnr(struct wlan_objmgr_vdev *vdev,
 			break;
 		}
 	}
+	qdf_mem_free(rnr);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -2410,14 +2414,17 @@ QDF_STATUS wlan_get_chan_by_link_id_from_rnr(struct wlan_objmgr_vdev *vdev,
 {
 	struct reduced_neighbor_report *rnr;
 	int i;
+	QDF_STATUS status;
 
 	*chan = 0;
+	rnr = qdf_mem_malloc(sizeof(*rnr));
+	if (!rnr)
+		return QDF_STATUS_E_NOMEM;
 
-	rnr = wlan_cm_get_rnr(vdev, cm_id);
-
-	if (!rnr) {
-		mlme_err("no rnr IE is gotten");
-		return QDF_STATUS_E_EMPTY;
+	status = wlan_cm_get_rnr(vdev, cm_id, rnr);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		qdf_mem_free(rnr);
+		return status;
 	}
 
 	for (i = 0; i < MAX_RNR_BSS; i++) {
@@ -2429,6 +2436,7 @@ QDF_STATUS wlan_get_chan_by_link_id_from_rnr(struct wlan_objmgr_vdev *vdev,
 			break;
 		}
 	}
+	qdf_mem_free(rnr);
 
 	return QDF_STATUS_SUCCESS;
 }