linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] ath10k: Fix potential Rx ring corruption
@ 2015-01-09 17:19 Vasanthakumar Thiagarajan
  2015-01-10  0:36 ` Ben Greear
  2015-01-13 14:22 ` Kalle Valo
  0 siblings, 2 replies; 6+ messages in thread
From: Vasanthakumar Thiagarajan @ 2015-01-09 17:19 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Vasanthakumar Thiagarajan

When replenishing Rx buffers driver updates the address of the
buffer and the index of rx buffer in rx ring to the firmware.
Change in order by CPU can cause rx ring corruption. Add memory
barrier before updating rx buffer index to guarantee the order.

This could fix some instances of rx ring corruption due to done
bit in rx attention flag not set.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/htt_rx.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 9c782a4..baa1c44 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -97,6 +97,11 @@ static int __ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num)
 	}
 
 fail:
+	/*
+	 * Make sure the rx buffer is updated before available buffer
+	 * index to avoid any potential rx ring corruption.
+	 */
+	mb();
 	*htt->rx_ring.alloc_idx.vaddr = __cpu_to_le32(idx);
 	return ret;
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-01-13 14:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-09 17:19 [PATCH RESEND] ath10k: Fix potential Rx ring corruption Vasanthakumar Thiagarajan
2015-01-10  0:36 ` Ben Greear
2015-01-10 19:01   ` Ben Greear
     [not found]     ` <1420969591846.36256@qti.qualcomm.com>
2015-01-11 10:06       ` Vasanthakumar Thiagarajan
2015-01-11 15:33         ` Ben Greear
2015-01-13 14:22 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).