Skip to contentSkip to conversation

wifi: qtnfmac: topaz: Fix dma_unmap_single() size

PATCH New Thomas Fourier 1 participant 1 message Oct 16 Quantenna qtnfmac wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: qtnfmac: topaz: Fix dma_unmap_single() size

In qtnf_pcie_data_tx(), the SKB is mapped with size skb->len, but it is unmapped in qtnf_topaz_free_xfer_buffers() with size SKB_BUF_SIZE. This could leave parts of the buffer mapped, and thus leave memory exposed to the device.

Change the size of the unmap to skb->len.

This bug was statically found and compile-tested only.

Fixes e401fa25cfa2 ("qtnfmac: add support for Topaz chipsets")
---
 drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c +1 -1
index a3a285f17dca..2e00bf68d001 100644
@@ -322,7 +322,7 @@ static void qtnf_topaz_free_xfer_buffers(struct qtnf_pcie_topaz_state *ts)
 			skb = priv->tx_skb[i];
 			paddr = QTN_HOST_ADDR(0x0, le32_to_cpu(txbd->addr));
 			dma_unmap_single(&priv->pdev->dev, paddr,
-					 SKB_BUF_SIZE, DMA_TO_DEVICE);
+					 skb->len, DMA_TO_DEVICE);
 			dev_kfree_skb_any(skb);
 			priv->tx_skb[i] = NULL;
 			txbd->addr = 0;
Signature · 1 line
2.53.0