* [PATCH] net/qla3xxx: fix potential memleak in ql_alloc_buffer_queues
@ 2023-12-27 7:02 Dinghao Liu
2024-01-04 1:00 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Dinghao Liu @ 2023-12-27 7:02 UTC (permalink / raw)
To: dinghao.liu
Cc: GR-Linux-NIC-Dev, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Ron Mercer, Jeff Garzik, netdev, linux-kernel
When dma_alloc_coherent() fails, we should free qdev->lrg_buf
to prevent potential memleak.
Fixes: 1357bfcf7106 ("qla3xxx: Dynamically size the rx buffer queue based on the MTU.")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
drivers/net/ethernet/qlogic/qla3xxx.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
index 0d57ffcedf0c..fc78bc959ded 100644
--- a/drivers/net/ethernet/qlogic/qla3xxx.c
+++ b/drivers/net/ethernet/qlogic/qla3xxx.c
@@ -2591,6 +2591,7 @@ static int ql_alloc_buffer_queues(struct ql3_adapter *qdev)
if (qdev->lrg_buf_q_alloc_virt_addr == NULL) {
netdev_err(qdev->ndev, "lBufQ failed\n");
+ kfree(qdev->lrg_buf);
return -ENOMEM;
}
qdev->lrg_buf_q_virt_addr = qdev->lrg_buf_q_alloc_virt_addr;
@@ -2615,6 +2616,7 @@ static int ql_alloc_buffer_queues(struct ql3_adapter *qdev)
qdev->lrg_buf_q_alloc_size,
qdev->lrg_buf_q_alloc_virt_addr,
qdev->lrg_buf_q_alloc_phy_addr);
+ kfree(qdev->lrg_buf);
return -ENOMEM;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net/qla3xxx: fix potential memleak in ql_alloc_buffer_queues
2023-12-27 7:02 [PATCH] net/qla3xxx: fix potential memleak in ql_alloc_buffer_queues Dinghao Liu
@ 2024-01-04 1:00 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-01-04 1:00 UTC (permalink / raw)
To: Dinghao Liu
Cc: GR-Linux-NIC-Dev, davem, edumazet, kuba, pabeni, ron.mercer, jeff,
netdev, linux-kernel
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 27 Dec 2023 15:02:27 +0800 you wrote:
> When dma_alloc_coherent() fails, we should free qdev->lrg_buf
> to prevent potential memleak.
>
> Fixes: 1357bfcf7106 ("qla3xxx: Dynamically size the rx buffer queue based on the MTU.")
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
> drivers/net/ethernet/qlogic/qla3xxx.c | 2 ++
> 1 file changed, 2 insertions(+)
Here is the summary with links:
- net/qla3xxx: fix potential memleak in ql_alloc_buffer_queues
https://git.kernel.org/netdev/net/c/89f45c30172c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-04 1:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-27 7:02 [PATCH] net/qla3xxx: fix potential memleak in ql_alloc_buffer_queues Dinghao Liu
2024-01-04 1:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox