net/qla3xxx: fix potential memleak in ql_alloc_buffer_queues
Subsystems (3)
PATCH 1/1 net/qla3xxx: fix potential memleak in ql_alloc_buffer_queues
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 <[email protected]>
--- drivers/net/ethernet/qlogic/qla3xxx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/qlogic/qla3xxx.c +2 -0
@@ -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 ; }
Signature · 1 line
2.17.1
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 27 Dec 2023 15:02:27 +0800 you wrote:
When
dma_alloc_coherent()fails, we should freeqdev->lrg_bufto prevent potential memleak.Fixes 1357bfcf7106 ("qla3xxx: Dynamically size the rx buffer queue based on the MTU.")Signed-off-by Dinghao Liu <[email protected]>--- 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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html