From 69a6025f67b41a3b03e165db46ea7d346a45ae81 Mon Sep 17 00:00:00 2001 From: Rakesh Pillai Date: Tue, 25 Jul 2017 15:04:17 +0530 Subject: [PATCH] ath10k: fix memory leak in rx ring buffer allocation The rx ring buffers are added to a hash table if firmare support full rx reorder. If the full rx reorder support flag is not set before allocating the rx ring buffers, none of the buffers are added to the hash table. When we unload the module, this hash table is checked for freeing the allocated rx ring buffers. Since none of the rx ring buffers were added to the hash table, this memory is leaked. Set the rx full reorder support flag before we allocate the rx ring buffer to avoid the memory leak. CRs-Fixed: 2081334 Change-Id: I6b7cbe05b914cf9aedd8e1ad54ccc4738f8b01e8 Signed-off-by: Rakesh Pillai --- drivers/net/wireless/ath/ath10k/core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 6906bddb229f..10b33840e5e5 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -1886,6 +1886,12 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode, goto err_wmi_detach; } + /* If firmware indicates Full Rx Reorder support it must be used in a + * slightly different manner. Let HTT code know. + */ + ar->htt.rx_ring.in_ord_rx = !!(test_bit(WMI_SERVICE_RX_FULL_REORDER, + ar->wmi.svc_map)); + status = ath10k_htt_rx_alloc(&ar->htt); if (status) { ath10k_err(ar, "failed to alloc htt rx: %d\n", status); @@ -1997,12 +2003,6 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode, } } - /* If firmware indicates Full Rx Reorder support it must be used in a - * slightly different manner. Let HTT code know. - */ - ar->htt.rx_ring.in_ord_rx = !!(test_bit(WMI_SERVICE_RX_FULL_REORDER, - ar->wmi.svc_map)); - status = ath10k_htt_rx_ring_refill(ar); if (status) { ath10k_err(ar, "failed to refill htt rx ring: %d\n", status);