Re: [PATCH for-next 09/14] RDMA/bnxt_re: Do not free the ctx_tbl entry if delete GID fails

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

 



On Wed, May 10, 2017 at 03:45:34AM -0700, Selvin Xavier wrote:
> Do not free context table entry if delete GID fails. Stack may call
> back the add_gid for the same context again which could result in
> panic

"may call" ??? Will you leave memory leak if this "may call" won't happen?


>
> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@xxxxxxxxxxxx>
> Signed-off-by: Selvin Xavier <selvin.xavier@xxxxxxxxxxxx>
> ---
>  drivers/infiniband/hw/bnxt_re/ib_verbs.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> index 61703f3..525f4b0 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> @@ -375,15 +375,17 @@ int bnxt_re_del_gid(struct ib_device *ibdev, u8 port_num,
>  			return -EINVAL;
>  		ctx->refcnt--;
>  		if (!ctx->refcnt) {
> -			rc = bnxt_qplib_del_sgid
> -					(sgid_tbl,
> -					 &sgid_tbl->tbl[ctx->idx], true);
> -			if (rc)
> +			rc = bnxt_qplib_del_sgid(sgid_tbl,
> +						 &sgid_tbl->tbl[ctx->idx],
> +						 true);
> +			if (rc) {
>  				dev_err(rdev_to_dev(rdev),
>  					"Failed to remove GID: %#x", rc);
> -			ctx_tbl = sgid_tbl->ctx;
> -			ctx_tbl[ctx->idx] = NULL;
> -			kfree(ctx);
> +			} else {
> +				ctx_tbl = sgid_tbl->ctx;
> +				ctx_tbl[ctx->idx] = NULL;
> +				kfree(ctx);
> +			}
>  		}
>  	} else {
>  		return -EINVAL;
> --
> 2.5.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Attachment: signature.asc
Description: PGP signature


[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