* [PATCH] wifi: mt76: fix potential memory leakage
@ 2022-12-16 2:29 Bo Jiao
2022-12-16 16:48 ` Lorenzo Bianconi
0 siblings, 1 reply; 2+ messages in thread
From: Bo Jiao @ 2022-12-16 2:29 UTC (permalink / raw)
To: Felix Fietkau
Cc: linux-wireless, Ryder Lee, Sujuan Chen, Shayne Chen, Evelyn Tsai,
linux-mediatek, Bo Jiao
From: Bo Jiao <Bo.Jiao@mediatek.com>
fix potential memory leakage, recycle rxwi when mt76_dma_add_buf() call fails.
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/dma.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
index fc24b35..9053344 100644
--- a/drivers/net/wireless/mediatek/mt76/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/dma.c
@@ -592,6 +592,7 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
qbuf.len = len - offset;
qbuf.skip_unmap = false;
if (mt76_dma_add_buf(dev, q, &qbuf, 1, 0, buf, t) < 0) {
+ mt76_put_rxwi(dev, t);
dma_unmap_single(dev->dma_dev, addr, len,
DMA_FROM_DEVICE);
skb_free_frag(buf);
--
2.18.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] wifi: mt76: fix potential memory leakage
2022-12-16 2:29 [PATCH] wifi: mt76: fix potential memory leakage Bo Jiao
@ 2022-12-16 16:48 ` Lorenzo Bianconi
0 siblings, 0 replies; 2+ messages in thread
From: Lorenzo Bianconi @ 2022-12-16 16:48 UTC (permalink / raw)
To: Bo Jiao
Cc: Felix Fietkau, linux-wireless, Ryder Lee, Sujuan Chen,
Shayne Chen, Evelyn Tsai, linux-mediatek
[-- Attachment #1: Type: text/plain, Size: 972 bytes --]
> From: Bo Jiao <Bo.Jiao@mediatek.com>
>
> fix potential memory leakage, recycle rxwi when mt76_dma_add_buf() call fails.
>
> Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
> ---
> drivers/net/wireless/mediatek/mt76/dma.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
> index fc24b35..9053344 100644
> --- a/drivers/net/wireless/mediatek/mt76/dma.c
> +++ b/drivers/net/wireless/mediatek/mt76/dma.c
> @@ -592,6 +592,7 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
> qbuf.len = len - offset;
> qbuf.skip_unmap = false;
> if (mt76_dma_add_buf(dev, q, &qbuf, 1, 0, buf, t) < 0) {
> + mt76_put_rxwi(dev, t);
I think we should add it even if page_frag_alloc or dma_map_single fail.
Regards,
Lorenzo
> dma_unmap_single(dev->dma_dev, addr, len,
> DMA_FROM_DEVICE);
> skb_free_frag(buf);
> --
> 2.18.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-16 16:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-16 2:29 [PATCH] wifi: mt76: fix potential memory leakage Bo Jiao
2022-12-16 16:48 ` Lorenzo Bianconi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox