Re: [PATCH][next] RDMA/ucma: fix memory leak of mc on an xa_alloc failure

From: Jason Gunthorpe
Date: Wed Sep 02 2020 - 19:59:16 EST


On Wed, Sep 02, 2020 at 05:28:05PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>
> Currently when an xa_alloc failure occurs the error exit path leaks
> the allocated object mc. Fix this by adding an error return path
> that frees mc and rename error exit paths err3 to err4 and err2 to err3.
>
> Fixes: 95fe51096b7a ("RDMA/ucma: Remove mc_list and rely on xarray")
> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> ---
> drivers/infiniband/core/ucma.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)

Alex beat you too it, so I will use his patch, thanks

Jason