]> git.hungrycats.org Git - linux/commit
IB/hfi1: Fix a memleak in init_credit_return
authorZhipeng Lu <alexious@zju.edu.cn>
Fri, 12 Jan 2024 08:55:23 +0000 (16:55 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Mar 2024 12:26:34 +0000 (13:26 +0100)
commitf0d857ce31a6bc7a82afcdbadb8f7417d482604b
tree423c29703863682c2435aa0e5da62af3035bf636
parenta6cada89ee5af2194f3ae62bebe4a821eaebe690
IB/hfi1: Fix a memleak in init_credit_return

[ Upstream commit 809aa64ebff51eb170ee31a95f83b2d21efa32e2 ]

When dma_alloc_coherent fails to allocate dd->cr_base[i].va,
init_credit_return should deallocate dd->cr_base and
dd->cr_base[i] that allocated before. Or those resources
would be never freed and a memleak is triggered.

Fixes: 7724105686e7 ("IB/hfi1: add driver files")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Link: https://lore.kernel.org/r/20240112085523.3731720-1-alexious@zju.edu.cn
Acked-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/hfi1/pio.c