Browse Source

qcacld-3.0: Add check for T2LM direction

Check if t2lm direction is valid before accessing the t2lm structure.

Change-Id: I3a92999f7cb9c84190c67e41564feec03dae56cb
CRs-Fixed: 3578829
Amruta Kulkarni 1 year ago
parent
commit
3bc1dd9b5f
1 changed files with 7 additions and 2 deletions
  1. 7 2
      components/umac/mlme/mlo_mgr/src/wlan_t2lm_api.c

+ 7 - 2
components/umac/mlme/mlo_mgr/src/wlan_t2lm_api.c

@@ -48,7 +48,7 @@ const char *t2lm_get_event_str(enum wlan_t2lm_evt event)
 static
 bool t2lm_is_valid_t2lm_link_map(struct wlan_objmgr_vdev *vdev,
 				 struct wlan_t2lm_onging_negotiation_info *t2lm,
-				 uint8_t *valid_dir)
+				 enum wlan_t2lm_direction *valid_dir)
 {
 	uint8_t i, tid = 0;
 	enum wlan_t2lm_direction dir = WLAN_T2LM_INVALID_DIRECTION;
@@ -136,7 +136,7 @@ QDF_STATUS t2lm_handle_rx_req(struct wlan_objmgr_vdev *vdev,
 {
 	struct wlan_t2lm_onging_negotiation_info t2lm_req = {0};
 	struct wlan_t2lm_info *t2lm_info;
-	uint8_t dir = WLAN_T2LM_MAX_DIRECTION;
+	enum wlan_t2lm_direction dir = WLAN_T2LM_MAX_DIRECTION;
 	bool valid_map = false;
 	QDF_STATUS status;
 	struct wlan_mlo_peer_context *ml_peer;
@@ -165,6 +165,11 @@ QDF_STATUS t2lm_handle_rx_req(struct wlan_objmgr_vdev *vdev,
 		mlme_err("reject t2lm conf");
 	}
 
+	if (dir >= WLAN_T2LM_MAX_DIRECTION) {
+		mlme_err("Received T2LM IE has invalid direction");
+		status = QDF_STATUS_E_INVAL;
+	}
+
 	if (QDF_IS_STATUS_SUCCESS(status) &&
 	    t2lm_req.t2lm_info[dir].direction != WLAN_T2LM_INVALID_DIRECTION) {
 		wlan_t2lm_clear_peer_negotiation(peer);