From ca2afe289822a0583f0ccceb04b4bb5220c8d2c6 Mon Sep 17 00:00:00 2001 From: Himanshu Batra Date: Mon, 2 Nov 2020 09:26:43 +0530 Subject: [PATCH] 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 --- .../src/wlan_serialization_non_scan.c | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/umac/cmn_services/serialization/src/wlan_serialization_non_scan.c b/umac/cmn_services/serialization/src/wlan_serialization_non_scan.c index a9d60c744ad7..225eabeeccdf 100644 --- a/umac/cmn_services/serialization/src/wlan_serialization_non_scan.c +++ b/umac/cmn_services/serialization/src/wlan_serialization_non_scan.c @@ -339,9 +339,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; @@ -417,12 +419,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);