All of lore.kernel.org
 help / color / mirror / Atom feed
From: "lizhijian@fujitsu.com" <lizhijian@fujitsu.com>
To: Bob Pearson <rpearsonhpe@gmail.com>,
	"jgg@nvidia.com" <jgg@nvidia.com>,
	"zyjzyj2000@gmail.com" <zyjzyj2000@gmail.com>,
	"jhack@hpe.com" <jhack@hpe.com>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>
Subject: RE: [PATCH v5 for-next 2/2] RDMA/rxe: Test mr->umem before releasing umem
Date: Mon, 22 Aug 2022 05:50:08 +0000	[thread overview]
Message-ID: <TYCPR01MB93052D25FB7FDB83DCF7AD90A5719@TYCPR01MB9305.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <20220805183153.32007-3-rpearsonhpe@gmail.com>



> -----Original Message-----
> From: Bob Pearson <rpearsonhpe@gmail.com>
> Sent: Saturday, August 6, 2022 2:32 AM
> To: jgg@nvidia.com; zyjzyj2000@gmail.com; Li, Zhijian/李 智坚
> <lizhijian@fujitsu.com>; jhack@hpe.com; linux-rdma@vger.kernel.org
> Cc: Bob Pearson <rpearsonhpe@gmail.com>
> Subject: [PATCH v5 for-next 2/2] RDMA/rxe: Test mr->umem before releasing
> umem
> 
> In rxe_mr_cleanup() test mr->umem before calling ib_umem_release() since in
> some error paths it may not be set.
> 
> Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_mr.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c
> b/drivers/infiniband/sw/rxe/rxe_mr.c
> index af34f198e645..f0726e8ee855 100644
> --- a/drivers/infiniband/sw/rxe/rxe_mr.c
> +++ b/drivers/infiniband/sw/rxe/rxe_mr.c
> @@ -627,7 +627,9 @@ void rxe_mr_cleanup(struct rxe_pool_elem *elem)
>  	int i;
> 
>  	rxe_put(mr_pd(mr));
> -	ib_umem_release(mr->umem);
> +
> +	if (mr->umem)
> +		ib_umem_release(mr->umem);

It's safe to pass a NULL to ib_umem_release() where it has a such check.


Thanks
Zhijian

> 
>  	if (mr->map) {
>  		for (i = 0; i < mr->num_map; i++)
> --
> 2.34.1


  reply	other threads:[~2022-08-22  5:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05 18:31 [PATCH v5 for-next 0/2] RDMA/rxe: Fix error paths in MR alloc routines Bob Pearson
2022-08-05 18:31 ` [PATCH v5 1/2] RDMA/rxe: Set pd early in mr " Bob Pearson
2022-08-05 18:36   ` Bob Pearson
2022-09-26 17:27   ` Jason Gunthorpe
2022-08-05 18:31 ` [PATCH v5 for-next 2/2] RDMA/rxe: Test mr->umem before releasing umem Bob Pearson
2022-08-22  5:50   ` lizhijian [this message]
2022-08-22 19:08     ` Bob Pearson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=TYCPR01MB93052D25FB7FDB83DCF7AD90A5719@TYCPR01MB9305.jpnprd01.prod.outlook.com \
    --to=lizhijian@fujitsu.com \
    --cc=jgg@nvidia.com \
    --cc=jhack@hpe.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=rpearsonhpe@gmail.com \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.