RDMA/rxe: Fix memory leak in error path code
authorBob Pearson <rpearsonhpe@gmail.com>
Mon, 5 Jul 2021 16:41:54 +0000 (11:41 -0500)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 15 Jul 2021 17:44:12 +0000 (14:44 -0300)
commitb18c7da63fcb46e2f9a093cc18d7c219e13a887c
treea5c6f22a30c4b51ceead98508031d9850d0be343
parentc9538831b353b96cb37092c3d3e929d67fd43c5f
RDMA/rxe: Fix memory leak in error path code

In rxe_mr_init_user() at the third error the driver fails to free the
memory at mr->map. This patch adds code to do that.  This error only
occurs if page_address() fails to return a non zero address which should
never happen for 64 bit architectures.

Fixes: 8700e3e7c485 ("Soft RoCE driver")
Link: https://lore.kernel.org/r/20210705164153.17652-1-rpearsonhpe@gmail.com
Reported by: Haakon Bugge <haakon.bugge@oracle.com>
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
Reviewed-by: Zhu Yanjun <zyjzyj2000@gmail.com>
Reviewed-by: HÃ¥kon Bugge <haakon.bugge@oracle.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/sw/rxe/rxe_mr.c