Browse Source

qcacmn: Reject link switch if link is already active on other vdev

Currently host is directly acting on the link_id for which link switch
is requested, if the link is already active on the other vdev if the
link switch is not sanitized resulting in firmware ending up
in bad state.

Reject the link switch if the link is already active on different vdev.

CRs-Fixed: 3635416
Change-Id: Idf445dcc487540c4faac7cf98abf7c214512d750
Arun Kumar Khandavalli 1 year ago
parent
commit
9292763c72
1 changed files with 10 additions and 2 deletions
  1. 10 2
      umac/mlo_mgr/src/wlan_mlo_mgr_link_switch.c

+ 10 - 2
umac/mlo_mgr/src/wlan_mlo_mgr_link_switch.c

@@ -1044,6 +1044,7 @@ mlo_mgr_link_switch_validate_request(struct wlan_objmgr_vdev *vdev,
 {
 	QDF_STATUS status = QDF_STATUS_E_INVAL;
 	uint8_t vdev_id = wlan_vdev_get_id(vdev);
+	struct mlo_link_info *new_link_info;
 
 	if (req->curr_ieee_link_id >= WLAN_INVALID_LINK_ID ||
 	    req->new_ieee_link_id >= WLAN_INVALID_LINK_ID) {
@@ -1052,13 +1053,20 @@ mlo_mgr_link_switch_validate_request(struct wlan_objmgr_vdev *vdev,
 		return status;
 	}
 
-	if (!mlo_mgr_get_ap_link_by_link_id(vdev->mlo_dev_ctx,
-					    req->new_ieee_link_id)) {
+	new_link_info = mlo_mgr_get_ap_link_by_link_id(vdev->mlo_dev_ctx,
+						       req->new_ieee_link_id);
+	if (!new_link_info) {
 		mlo_err("New link id %d not part of association",
 			req->new_ieee_link_id);
 		return status;
 	}
 
+	if (new_link_info->vdev_id != WLAN_INVALID_VDEV_ID) {
+		mlo_err("requested link already active on other vdev:%d",
+			new_link_info->vdev_id);
+		return status;
+	}
+
 	if (!mlo_is_mld_sta(vdev)) {
 		mlo_err("Link switch req not valid for VDEV %d", vdev_id);
 		return status;