aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>2014-03-17 09:34:17 -0400
committerJohn W. Linville <linville@tuxdriver.com>2014-03-17 13:44:18 -0400
commit8bf6adb988c6843f0e58d2b210526cf947a8a746 (patch)
tree911326c6ad96a61015c909dc7063847e3def2f4a /drivers/net/wireless
parentfa4a18e73b21402ed00cfb852d94d169994c5aa3 (diff)
wil6210: fix memory leak in the AP flow
When switching between STA and AP modes, memory allocated for Rx vring leaks This is because start_ap() allocates Rx vring but stop_ap() do not free it. Logically, Rx vring is not valid (HW can't use it anymore), so free it in reset() Also, check double init for Rx vring and bail out with -EINVAL Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ath/wil6210/main.c2
-rw-r--r--drivers/net/wireless/ath/wil6210/txrx.c5
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c
index 684762203a62..de952ab78607 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -343,6 +343,8 @@ int wil_reset(struct wil6210_priv *wil)
343 /* TODO: put MAC in reset */ 343 /* TODO: put MAC in reset */
344 wil_target_reset(wil); 344 wil_target_reset(wil);
345 345
346 wil_rx_fini(wil);
347
346 /* init after reset */ 348 /* init after reset */
347 wil->pending_connect_cid = -1; 349 wil->pending_connect_cid = -1;
348 reinit_completion(&wil->wmi_ready); 350 reinit_completion(&wil->wmi_ready);
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
index 5cda0ea9925f..97d036adb382 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -557,6 +557,11 @@ int wil_rx_init(struct wil6210_priv *wil)
557 struct vring *vring = &wil->vring_rx; 557 struct vring *vring = &wil->vring_rx;
558 int rc; 558 int rc;
559 559
560 if (vring->va) {
561 wil_err(wil, "Rx ring already allocated\n");
562 return -EINVAL;
563 }
564
560 vring->size = WIL6210_RX_RING_SIZE; 565 vring->size = WIL6210_RX_RING_SIZE;
561 rc = wil_vring_alloc(wil, vring); 566 rc = wil_vring_alloc(wil, vring);
562 if (rc) 567 if (rc)