diff mbox series

wifi: mt76: add memory barrier to SDIO queue kick

Message ID 2489b17e8249ef8db840edb6168888ff5c887a6b.1673754074.git.deren.wu@mediatek.com
State New
Headers show
Series wifi: mt76: add memory barrier to SDIO queue kick | expand

Commit Message

Deren Wu Jan. 15, 2023, 4:44 a.m. UTC
Ensure the entry has been fully updated before SDIO bus worker access
it. This patch would fix potential memory risk in both mt7663s and
mt7921s.

Fixes: 764dee47e2c1 ("mt76: sdio: move common code in mt76_sdio module")
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/sdio.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

AngeloGioacchino Del Regno Jan. 16, 2023, 11:57 a.m. UTC | #1
Il 15/01/23 05:44, Deren Wu ha scritto:
> Ensure the entry has been fully updated before SDIO bus worker access
> it. This patch would fix potential memory risk in both mt7663s and
> mt7921s.
> 
> Fixes: 764dee47e2c1 ("mt76: sdio: move common code in mt76_sdio module")
> Signed-off-by: Deren Wu <deren.wu@mediatek.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c
index 228bc7d45011..419723118ded 100644
--- a/drivers/net/wireless/mediatek/mt76/sdio.c
+++ b/drivers/net/wireless/mediatek/mt76/sdio.c
@@ -562,6 +562,10 @@  mt76s_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q,
 
 	q->entry[q->head].buf_sz = len;
 	q->entry[q->head].skb = skb;
+
+	/* ensure the entry fully updated before bus access */
+	smp_wmb();
+
 	q->head = (q->head + 1) % q->ndesc;
 	q->queued++;