Skip to contentSkip to conversation

mt76: fix potential DMA mapping leak

PATCH In review Felix Fietkau 2 participants 3 messages Mar 23, 2021 – Apr 11, 2021 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Felix Fietkau

author maintainer
#0 lore raw

PATCH 1/1 mt76: fix potential DMA mapping leak

With buf uninitialized in mt76_dma_tx_queue_skb_raw, its field skip_unmap could potentially inherit a non-zero value from stack garbage. If this happens, it will cause DMA mappings for MCU command frames to not be unmapped after completion

Fixes 27d5c528a7ca ("mt76: fix double DMA unmap of the first buffer on 7615/7915")
---
 drivers/net/wireless/mediatek/mt76/dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/dma.c +1 -1
index 2f27c43ad76d..7196fa9047e6 100644
@@ -309,7 +309,7 @@ static int
 mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q,
 			  struct sk_buff *skb, u32 tx_info)
 {
-	struct mt76_queue_buf buf;
+	struct mt76_queue_buf buf = {};
 	dma_addr_t addr;
 
 	if (q->queued + 1 >= q->ndesc - 1)
Signature · 1 line
2.30.1
#1 lore raw
Quoted 8 lines · Felix Fietkau

With buf uninitialized in mt76_dma_tx_queue_skb_raw, its field skip_unmap could potentially inherit a non-zero value from stack garbage. If this happens, it will cause DMA mappings for MCU command frames to not be unmapped after completion

Fixes 27d5c528a7ca ("mt76: fix double DMA unmap of the first buffer on 7615/7915")

Sorry, I missed this and I suspect it's now too late for v5.12. Felix, can you instead take this to your tree so that we can get this to v5.13? I assigned this to you on patchwork.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

A message that is not in the archive (sent off-list or not yet received): [email protected]

author maintainer
#3 lore raw
Quoted 7 lines · Kalle Valo
Quoted 5 lines · Felix Fietkau

With buf uninitialized in mt76_dma_tx_queue_skb_raw, its field skip_unmap could potentially inherit a non-zero value from stack garbage. If this happens, it will cause DMA mappings for MCU command frames to not be unmapped after completion

Quoted 7 lines
Quoted 3 lines
Fixes 27d5c528a7ca ("mt76: fix double DMA unmap of the first buffer on 7615/7915")

Sorry, I missed this and I suspect it's now too late for v5.12. Felix, can you instead take this to your tree so that we can get this to v5.13? I assigned this to you on patchwork.

Will do. I plan on sending an updated pull request today.

- Felix