aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/wil6210
diff options
context:
space:
mode:
authorMaya Erez <merez@codeaurora.org>2018-08-23 07:47:11 -0400
committerKalle Valo <kvalo@codeaurora.org>2018-08-28 09:48:55 -0400
commit84f16fbb62384fb209cd35741d94eb00b5ca2746 (patch)
treec423807f073a70e69770b45aaeccf367a119f09f /drivers/net/wireless/ath/wil6210
parentdf2b53884a5a454bf441ca78e5b57307262c73f4 (diff)
wil6210: fix RX buffers release and unmap
RX SKBs are released in both wil6210 rmmod and RX handle. As there is no lock to protect the buffers DMA unmap, the SKB pointer in buff_arr is used to check if the buffer memory was already released. Setting wil->rx_buff_mgmt.buff_arr[buff_id].skb to NULL before the DMA memory unmap will prevent duplicate unmapping of the same memory. Move the buffer ID to the free list also in case the SKB is NULL. Signed-off-by: Maya Erez <merez@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/ath/wil6210')
-rw-r--r--drivers/net/wireless/ath/wil6210/txrx_edma.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/wireless/ath/wil6210/txrx_edma.c b/drivers/net/wireless/ath/wil6210/txrx_edma.c
index bca61cb44c37..3e7fc2983cbb 100644
--- a/drivers/net/wireless/ath/wil6210/txrx_edma.c
+++ b/drivers/net/wireless/ath/wil6210/txrx_edma.c
@@ -279,9 +279,6 @@ static void wil_move_all_rx_buff_to_free_list(struct wil6210_priv *wil,
279 u16 buff_id; 279 u16 buff_id;
280 280
281 *d = *_d; 281 *d = *_d;
282 pa = wil_rx_desc_get_addr_edma(&d->dma);
283 dmalen = le16_to_cpu(d->dma.length);
284 dma_unmap_single(dev, pa, dmalen, DMA_FROM_DEVICE);
285 282
286 /* Extract the SKB from the rx_buff management array */ 283 /* Extract the SKB from the rx_buff management array */
287 buff_id = __le16_to_cpu(d->mac.buff_id); 284 buff_id = __le16_to_cpu(d->mac.buff_id);
@@ -291,10 +288,15 @@ static void wil_move_all_rx_buff_to_free_list(struct wil6210_priv *wil,
291 } 288 }
292 skb = wil->rx_buff_mgmt.buff_arr[buff_id].skb; 289 skb = wil->rx_buff_mgmt.buff_arr[buff_id].skb;
293 wil->rx_buff_mgmt.buff_arr[buff_id].skb = NULL; 290 wil->rx_buff_mgmt.buff_arr[buff_id].skb = NULL;
294 if (unlikely(!skb)) 291 if (unlikely(!skb)) {
295 wil_err(wil, "No Rx skb at buff_id %d\n", buff_id); 292 wil_err(wil, "No Rx skb at buff_id %d\n", buff_id);
296 else 293 } else {
294 pa = wil_rx_desc_get_addr_edma(&d->dma);
295 dmalen = le16_to_cpu(d->dma.length);
296 dma_unmap_single(dev, pa, dmalen, DMA_FROM_DEVICE);
297
297 kfree_skb(skb); 298 kfree_skb(skb);
299 }
298 300
299 /* Move the buffer from the active to the free list */ 301 /* Move the buffer from the active to the free list */
300 list_move(&wil->rx_buff_mgmt.buff_arr[buff_id].list, 302 list_move(&wil->rx_buff_mgmt.buff_arr[buff_id].list,
@@ -906,6 +908,9 @@ again:
906 wil->rx_buff_mgmt.buff_arr[buff_id].skb = NULL; 908 wil->rx_buff_mgmt.buff_arr[buff_id].skb = NULL;
907 if (!skb) { 909 if (!skb) {
908 wil_err(wil, "No Rx skb at buff_id %d\n", buff_id); 910 wil_err(wil, "No Rx skb at buff_id %d\n", buff_id);
911 /* Move the buffer from the active list to the free list */
912 list_move(&wil->rx_buff_mgmt.buff_arr[buff_id].list,
913 &wil->rx_buff_mgmt.free);
909 goto again; 914 goto again;
910 } 915 }
911 916