Sfoglia il codice sorgente

qcacmn: Fix memory leak in case of pdev attach failure

The cleanup done in case of pdev attach failure
does not deinitialize the IPA tx and rx buffers.
Also the tx descriptors are not freed in this
cleanup path.
Due to this, the tx descriptors and IPA tx/rx
buffers memory is neither freed not unmapped.

Fix this pdev attach failure cleanup path to
avoid memory leaks.

Change-Id: I570e3618f0f48f56749466fce5bcba5a4ef1c161
CRs-Fixed: 2663036
Rakesh Pillai 5 anni fa
parent
commit
f77acaf949
1 ha cambiato i file con 7 aggiunte e 3 eliminazioni
  1. 7 3
      dp/wifi3.0/dp_main.c

+ 7 - 3
dp/wifi3.0/dp_main.c

@@ -3297,8 +3297,6 @@ static void dp_soc_cmn_cleanup(struct dp_soc *soc)
 	}
 
 	qdf_spinlock_destroy(&soc->rx.defrag.defrag_lock);
-
-	dp_reo_cmdlist_destroy(soc);
 	qdf_spinlock_destroy(&soc->rx.reo_cmd_lock);
 }
 
@@ -4012,8 +4010,10 @@ wdi_attach_fail:
 
 fail2:
 	dp_rx_pdev_detach(pdev);
+	dp_ipa_uc_detach(soc, pdev);
 
 fail1:
+	soc->pdev_count--;
 	if (pdev->invalid_peer)
 		qdf_mem_free(pdev->invalid_peer);
 
@@ -4323,7 +4323,7 @@ static void dp_pdev_deinit(struct cdp_pdev *txrx_pdev, int force)
 
 	/* only do soc common cleanup when last pdev do detach */
 	if (!(soc->pdev_count))
-		dp_soc_cmn_cleanup(soc);
+		dp_reo_cmdlist_destroy(soc);
 
 	wlan_cfg_pdev_detach(pdev->wlan_cfg_ctx);
 	if (pdev->invalid_peer)
@@ -4432,6 +4432,10 @@ static void dp_pdev_detach(struct cdp_pdev *txrx_pdev, int force)
 		dp_rx_desc_pool_free(soc, rx_desc_pool);
 	}
 
+	/* only do soc common cleanup when last pdev do detach */
+	if (!(soc->pdev_count))
+		dp_soc_cmn_cleanup(soc);
+
 	soc->pdev_list[pdev->pdev_id] = NULL;
 	wlan_minidump_remove(pdev);
 	qdf_mem_free(pdev);