[PATCH net-next] wifi: qtnfmac: topaz: Fix dma_unmap_single() size
From: Thomas Fourier
Date: Fri Oct 16 2026 - 09:48:54 EST
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")
Signed-off-by: Thomas Fourier <fourier.thomas@xxxxxxxxx>
---
drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c
index a3a285f17dca..2e00bf68d001 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c
@@ -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;
--
2.53.0