Loading
IB/hfi1: Fix a memleak in init_credit_return
stable inclusion from stable-v5.10.211 commit 3fa240bb6b2dbb3e7a3ee1440a4889cbb6207eb7 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9HJPD CVE: CVE-2024-26839 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=3fa240bb6b2dbb3e7a3ee1440a4889cbb6207eb7 -------------------------------- [ 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: 77241056 ("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> Signed-off-by:
Zhenzeng Su <suzhenzeng@huawei.com> (cherry picked from commit dbc9145b)