RE: [PATCH] RDMA/siw: fix refcounting leak in siw_create_qp()

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

 



> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Sent: Tuesday, 18 January 2022 10:11
> To: Bernard Metzler <BMT@xxxxxxxxxxxxxx>; Leon Romanovsky
> <leonro@xxxxxxxxxx>
> Cc: Jason Gunthorpe <jgg@xxxxxxxx>; Gal Pressman <galpress@xxxxxxxxxx>;
> Dennis Dalessandro <dennis.dalessandro@xxxxxxxxxxxxxxxxxxxx>; linux-
> rdma@xxxxxxxxxxxxxxx; kernel-janitors@xxxxxxxxxxxxxxx
> Subject: [EXTERNAL] [PATCH] RDMA/siw: fix refcounting leak in
> siw_create_qp()
> 
> The atomic_inc() needs to be paired with an atomic_dec() on the error
> path.
> 
> Fixes: 514aee660df4 ("RDMA: Globally allocate and release QP memory")
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
>  drivers/infiniband/sw/siw/siw_verbs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/sw/siw/siw_verbs.c
> b/drivers/infiniband/sw/siw/siw_verbs.c
> index a3dd2cb6d5c9..54ef367b074a 100644
> --- a/drivers/infiniband/sw/siw/siw_verbs.c
> +++ b/drivers/infiniband/sw/siw/siw_verbs.c
> @@ -313,7 +313,8 @@ int siw_create_qp(struct ib_qp *ibqp, struct
> ib_qp_init_attr *attrs,
> 
>  	if (atomic_inc_return(&sdev->num_qp) > SIW_MAX_QP) {
>  		siw_dbg(base_dev, "too many QP's\n");
> -		return -ENOMEM;
> +		rv = -ENOMEM;
> +		goto err_atomic;
>  	}
>  	if (attrs->qp_type != IB_QPT_RC) {
>  		siw_dbg(base_dev, "only RC QP's supported\n");
> --
> 2.20.1

Good catch, thank you!

Reviewed-by: Bernard Metzler <bmt@xxxxxxxxxxxxxx>




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux