mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-15 23:14:31 +08:00
net/qla3xxx: fix potential memleak in ql_alloc_buffer_queues
[ Upstream commit89f45c3017
] When dma_alloc_coherent() fails, we should free qdev->lrg_buf to prevent potential memleak. Fixes:1357bfcf71
("qla3xxx: Dynamically size the rx buffer queue based on the MTU.") Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Link: https://lore.kernel.org/r/20231227070227.10527-1-dinghao.liu@zju.edu.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
3ffd05c2cc
commit
ed192246db
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user