浏览代码

qcacmn: Update queue size from pending queue after command activation

As part of activaiton of serialization command from pending to
active queue, the lock is released. In the activation API, the
same API to move non scan cmds from pending to active queue can
be called if activation fails. This reentrant API may modify the
pending queue even before the control is given back to the caller
API leading to random behavior when accesing the next cmd from pending
queue via local variables.

Add fix to update queue size from pending queue after command activation

Change-Id: I8082e2a9dd3410369967ab20196853ddfa0639a7
CRs-Fixed: 2801956
Himanshu Batra 4 年之前
父节点
当前提交
f7d6997020
共有 1 个文件被更改,包括 15 次插入6 次删除
  1. 15 6
      umac/cmn_services/serialization/src/wlan_serialization_non_scan.c

+ 15 - 6
umac/cmn_services/serialization/src/wlan_serialization_non_scan.c

@@ -345,9 +345,11 @@ wlan_ser_move_non_scan_pending_to_active(
 						   &next_cmd_list->cmd_in_use);
 			}
 
-			if (vdev_cmd_active)
+			if (vdev_cmd_active) {
+				qdf_atomic_clear_bit(CMD_MARKED_FOR_MOVEMENT,
+						     &pending_cmd_list->cmd_in_use);
 				continue;
-
+			}
 		} else {
 			if (vdev_cmd_active)
 				break;
@@ -423,12 +425,19 @@ wlan_ser_move_non_scan_pending_to_active(
 		if (vdev_queue_lookup || pdev_queue->blocking_cmd_active)
 			break;
 
-		if (next_cmd_list) {
-			qdf_atomic_clear_bit(CMD_MARKED_FOR_MOVEMENT,
-					     &next_cmd_list->cmd_in_use);
+		qsize =  wlan_serialization_list_size(pending_queue);
+		if (!qsize) {
+			wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
+			goto error;
 		}
 
-		next_cmd_list = NULL;
+		qdf_status = wlan_serialization_peek_front(pending_queue,
+							   &pending_node);
+		if (qdf_status != QDF_STATUS_SUCCESS) {
+			ser_err("can't peek cmd");
+			wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
+			goto error;
+		}
 	}
 
 	wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);