Skip to content

Commit ed19224

Browse files
dinghaoliugregkh
authored andcommitted
net/qla3xxx: fix potential memleak in ql_alloc_buffer_queues
[ Upstream commit 89f45c3 ] When dma_alloc_coherent() fails, we should free qdev->lrg_buf to prevent potential memleak. Fixes: 1357bfc ("qla3xxx: Dynamically size the rx buffer queue based on the MTU.") Signed-off-by: Dinghao Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 3ffd05c commit ed19224

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/ethernet/qlogic/qla3xxx.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2591,6 +2591,7 @@ static int ql_alloc_buffer_queues(struct ql3_adapter *qdev)
25912591

25922592
if (qdev->lrg_buf_q_alloc_virt_addr == NULL) {
25932593
netdev_err(qdev->ndev, "lBufQ failed\n");
2594+
kfree(qdev->lrg_buf);
25942595
return -ENOMEM;
25952596
}
25962597
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)
26152616
qdev->lrg_buf_q_alloc_size,
26162617
qdev->lrg_buf_q_alloc_virt_addr,
26172618
qdev->lrg_buf_q_alloc_phy_addr);
2619+
kfree(qdev->lrg_buf);
26182620
return -ENOMEM;
26192621
}
26202622

0 commit comments

Comments
 (0)