]> git.baikalelectronics.ru Git - kernel.git/commit
mt76: fix tx skb error handling in mt76_dma_tx_queue_skb
authorFelix Fietkau <nbd@nbd.name>
Tue, 16 Feb 2021 13:51:18 +0000 (14:51 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 18 Feb 2021 06:09:09 +0000 (08:09 +0200)
commita60108d09b11f6a1fecb27e97e693f1558b7a86a
tree3628e7ce4f7291178f3ae132fddfa787b2772e15
parent45e6ea2a2e4f8e54096997cdf90bf0d81176710c
mt76: fix tx skb error handling in mt76_dma_tx_queue_skb

When running out of room in the tx queue after calling drv->tx_prepare_skb,
the buffer list will already have been modified on MT7615 and newer drivers.
This can leak a DMA mapping and will show up as swiotlb allocation failures
on x86.

Fix this by moving the queue length check further up. This is less accurate,
since it can overestimate the needed room in the queue on MT7615 and newer,
but the difference is small enough to not matter in practice.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210216135119.23809-1-nbd@nbd.name
drivers/net/wireless/mediatek/mt76/dma.c