From 9a0dcc9ffe9c2429c72b6d017bf0ad11324c483d Mon Sep 17 00:00:00 2001 From: Vinod Kumar Pirla Date: Mon, 22 Aug 2022 10:16:54 +0530 Subject: [PATCH] qcacld-3.0: Validate SMPS params before sending it to FW An invalid VDEV ID is sent to FW during adapter start after SSR leading to assertion failure. Validate return value of start adapter and skip to next adapter incase of any failure. Validate the VDEV ID sent in the SMPS params before sending to FW. Change-Id: I7038fb2c7ecaa5892f5058b5b719767314ec62bf CRs-Fixed: 3271202 --- core/hdd/src/wlan_hdd_main.c | 18 ++++++++++++++---- core/wma/src/wma_power.c | 5 +++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index d917003ae9..676bb7a884 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -8667,13 +8667,23 @@ QDF_STATUS hdd_start_all_adapters(struct hdd_context *hdd_ctx) case QDF_P2P_DEVICE_MODE: case QDF_NAN_DISC_MODE: - hdd_start_station_adapter(adapter); - + ret = hdd_start_station_adapter(adapter); + if (ret) { + hdd_err("[SSR] Failed to start station adapter: %d", + ret); + hdd_adapter_dev_put_debug(adapter, dbgid); + continue; + } if (adapter->device_mode == QDF_STA_MODE) { ret = hdd_start_link_adapter(adapter); - if (ret) - hdd_err("[SSR] Failed to start link adapter:%d", + if (ret) { + hdd_err("[SSR] Failed to start link adapter: %d", ret); + hdd_stop_adapter(hdd_ctx, adapter); + hdd_adapter_dev_put_debug(adapter, + dbgid); + continue; + } } /* Open the gates for HDD to receive Wext commands */ diff --git a/core/wma/src/wma_power.c b/core/wma/src/wma_power.c index 709d44299c..091916b80d 100644 --- a/core/wma/src/wma_power.c +++ b/core/wma/src/wma_power.c @@ -1490,6 +1490,11 @@ QDF_STATUS wma_set_smps_params(tp_wma_handle wma, uint8_t vdev_id, { QDF_STATUS ret; + if (!wma_is_vdev_valid(vdev_id)) { + wma_err("Invalid VDEV ID: %d", vdev_id); + return QDF_STATUS_E_INVAL; + } + ret = wmi_unified_set_smps_params(wma->wmi_handle, vdev_id, value); if (QDF_IS_STATUS_ERROR(ret))