linux/drivers/infiniband/sw
Jason Gunthorpe 6e051971b0 RDMA/siw: Fix potential siw_mem refcnt leak in siw_fastreg_mr()
siw_fastreg_mr() invokes siw_mem_id2obj(), which returns a local reference
of the siw_mem object to "mem" with increased refcnt.  When
siw_fastreg_mr() returns, "mem" becomes invalid, so the refcount should be
decreased to keep refcount balanced.

The issue happens in one error path of siw_fastreg_mr(). When "base_mr"
equals to NULL but "mem" is not NULL, the function forgets to decrease the
refcnt increased by siw_mem_id2obj() and causes a refcnt leak.

Reorganize the flow so that the goto unwind can be used as expected.

Fixes: b9be6f18cf ("rdma/siw: transmit path")
Link: https://lore.kernel.org/r/1586939949-69856-1-git-send-email-xiyuyang19@fudan.edu.cn
Reported-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
2020-04-15 11:26:51 -03:00
..
rdmavt RDMA 5.7 pull request 2020-04-01 18:18:18 -07:00
rxe RDMA/rxe: Set sys_image_guid to be aligned with HW IB devices 2020-03-26 16:45:29 -03:00
siw RDMA/siw: Fix potential siw_mem refcnt leak in siw_fastreg_mr() 2020-04-15 11:26:51 -03:00
Makefile rdma/siw: addition to kernel build environment 2019-07-02 17:03:41 -03:00