RE: [PATCH] RDMA/mlx5: check reg_create() create for errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Dan Carpenter <error27@xxxxxxxxx>
> Sent: Monday, February 6, 2023 8:11 PM
> To: Michael Guralnik <michaelgur@xxxxxxxxxx>; Leon Romanovsky
> <leon@xxxxxxxxxx>
> Cc: Jason Gunthorpe <jgg@xxxxxxxx>; linux-rdma@xxxxxxxxxxxxxxx; kernel-
> janitors@xxxxxxxxxxxxxxx
> Subject: [PATCH] RDMA/mlx5: check reg_create() create for errors
> 
> The reg_create() can fail.  Check for errors before dereferencing it.
> 
> Fixes: dd1b913fb0d0 ("RDMA/mlx5: Cache all user cacheable mkeys on dereg
> MR flow")
> Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>
> ---
>  drivers/infiniband/hw/mlx5/mr.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/infiniband/hw/mlx5/mr.c
> b/drivers/infiniband/hw/mlx5/mr.c index c396b942d0c8..2feab0818a76
> 100644
> --- a/drivers/infiniband/hw/mlx5/mr.c
> +++ b/drivers/infiniband/hw/mlx5/mr.c
> @@ -1164,6 +1164,8 @@ static struct mlx5_ib_mr
> *alloc_cacheable_mr(struct ib_pd *pd,
>  		mutex_lock(&dev->slow_path_mutex);
>  		mr = reg_create(pd, umem, iova, access_flags, page_size,
> false);
>  		mutex_unlock(&dev->slow_path_mutex);
> +		if (IS_ERR(mr))
> +			return mr;


Looks good
Reviewed-by: Devesh Sharma <devesh.s.sharma@xxxxxxxxxx>

>  		mr->mmkey.rb_key = rb_key;
>  		return mr;
>  	}
> --
> 2.35.1





[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux