]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
RDMA/hns: Fix memory leak on 'context' on error return path
authorColin Ian King <colin.king@canonical.com>
Thu, 24 Oct 2019 13:10:34 +0000 (14:10 +0100)
committerSeth Forshee <seth.forshee@canonical.com>
Mon, 6 Jan 2020 14:16:07 +0000 (08:16 -0600)
commit684a147b95b4a13ed763010a8f5665db2b455ce5
tree4ed34a5c2e4865b8ea13f1251bc13a676a286f66
parente823d40d162d468def8cdc6103767d774ce0b76b
RDMA/hns: Fix memory leak on 'context' on error return path

BugLink: https://bugs.launchpad.net/bugs/1858428
[ Upstream commit 994195e1537074f56df216a9309f6e366cb35b67 ]

Currently, the error return path when the call to function
dev->dfx->query_cqc_info fails will leak object 'context'. Fix this by
making the error return path via 'err' return return codes rather than
-EMSGSIZE, set ret appropriately for all error return paths and for the
memory leak now return via 'err' rather than just returning without
freeing context.

Link: https://lore.kernel.org/r/20191024131034.19989-1-colin.king@canonical.com
Addresses-Coverity: ("Resource leak")
Fixes: e1c9a0dc2939 ("RDMA/hns: Dump detailed driver-specific CQ")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/infiniband/hw/hns/hns_roce_restrack.c