From 40c5e4425aecac8dfbe8004f6d5c97dce4e4c541 Mon Sep 17 00:00:00 2001 From: Krunal Soni Date: Wed, 28 Feb 2018 11:40:15 -0800 Subject: [PATCH] qcacld-3.0: Self peer req is not handled properly causes P2P failure 1) When wma_self_peer_remove() API returns failure, driver triggers recovery without checking if driver unload is in progress which may cause driver to go in bad state. 2) when wma_self_peer_remove() API returns success, driver releases the memory accidently as part of I14895b0d3a19b3aaea2299311cc021ea14408f1e Fix 1st condition by checking if driver unload is in progress. If driver in unloading then just release the memory and return failure. If driver is not unloading then just trigger SSR recovery, so FW can recover silently. Fix 2nd condition by checking the return status and release the memory up on failure status code. CRs-Fixed: 2197657 Change-Id: Ia08dbdac66d8641d22f6a82c29ab1a5b99309214 --- core/wma/src/wma_dev_if.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index bdec6b50094b..4682bf91b8ed 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -530,7 +530,7 @@ static QDF_STATUS wma_self_peer_remove(tp_wma_handle wma_handle, if (!peer) { WMA_LOGE("%s Failed to find peer %pM", __func__, del_sta_self_req_param->self_mac_addr); - qdf_status = QDF_STATUS_SUCCESS; + qdf_status = QDF_STATUS_E_FAULT; goto error; } wma_remove_peer(wma_handle, @@ -793,8 +793,16 @@ QDF_STATUS wma_vdev_detach(tp_wma_handle wma_handle, if ((status != QDF_STATUS_SUCCESS) && generateRsp) { WMA_LOGE("can't remove selfpeer, send rsp session: %d", vdev_id); - goto send_fail_rsp; - } else { + if (!cds_is_driver_unloading()) { + WMA_LOGE("Trigger recovery for session: %d", + vdev_id); + goto send_fail_rsp; + } else { + WMA_LOGE("driver unload, free mem vdev_id: %d", + vdev_id); + goto send_rsp; + } + } else if (status != QDF_STATUS_SUCCESS) { WMA_LOGE("can't remove selfpeer, free msg session: %d", vdev_id); qdf_mem_free(pdel_sta_self_req_param);