All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Kamal Heib <kheib@redhat.com>
Cc: linux-rdma@vger.kernel.org, Jason Gunthorpe <jgg@ziepe.ca>,
	Michal Kalderon <mkalderon@marvell.com>,
	Ariel Elior <aelior@marvell.com>
Subject: Re: [PATCH for-rc] RDMA/qedr: Fix qedr_create_user_qp error flow
Date: Thu, 8 Feb 2024 10:00:34 +0200	[thread overview]
Message-ID: <20240208080034.GC56027@unreal> (raw)
In-Reply-To: <ZcQZ8cjtll07RQ2q@fedora-x1>

On Wed, Feb 07, 2024 at 07:01:53PM -0500, Kamal Heib wrote:
> On Wed, Feb 07, 2024 at 09:31:14AM +0200, Leon Romanovsky wrote:
> > On Tue, Feb 06, 2024 at 12:54:49PM -0500, Kamal Heib wrote:
> > > Avoid the following warning by making sure to call qedr_cleanup_user()
> > > in case qedr_init_user_queue() failed.
> > 
> > <...>
> > 
> > > diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
> > > index 7887a6786ed4..0943abd4de27 100644
> > > --- a/drivers/infiniband/hw/qedr/verbs.c
> > > +++ b/drivers/infiniband/hw/qedr/verbs.c
> > > @@ -1880,7 +1880,7 @@ static int qedr_create_user_qp(struct qedr_dev *dev,
> > >  		rc = qedr_init_user_queue(udata, dev, &qp->urq, ureq.rq_addr,
> > >  					  ureq.rq_len, true, 0, alloc_and_init);
> > >  		if (rc)
> > > -			return rc;
> > > +			goto err1;
> > 
> > "goto err1" will cause to call to qedr_cleanup_user() which will call to qedr_free_pbl()
> > with qp->urq.pbl_tbl) which can be NULL.
> > 
> > Thanks
> >
> 
> I see, what about something like the following:

It will work.

> 
> diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
> index 7887a6786ed4..f118ce0a9a61 100644
> --- a/drivers/infiniband/hw/qedr/verbs.c
> +++ b/drivers/infiniband/hw/qedr/verbs.c
> @@ -1879,8 +1879,17 @@ static int qedr_create_user_qp(struct qedr_dev *dev,
>                 /* RQ - read access only (0) */
>                 rc = qedr_init_user_queue(udata, dev, &qp->urq, ureq.rq_addr,
>                                           ureq.rq_len, true, 0, alloc_and_init);
> -               if (rc)
> +               if (rc) {
> +                       ib_umem_release(qp->usq.umem);
> +                       qp->usq.umem = NULL;
> +                       if (rdma_protocol_roce(&dev->ibdev, 1)) {
> +                               qedr_free_pbl(dev, &qp->usq.pbl_info,
> +                                             qp->usq.pbl_tbl);
> +                       } else {
> +                               kfree(qp->usq.pbl_tbl);
> +                       }
>                         return rc;
> +               }
>         }
>  
>         memset(&in_params, 0, sizeof(in_params));
> 
> 
> Thanks!
> 
>  
> > >  	}
> > >  
> > >  	memset(&in_params, 0, sizeof(in_params));
> > > -- 
> > > 2.43.0
> > > 
> > > 
> > 
> 

      reply	other threads:[~2024-02-08  8:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 17:54 [PATCH for-rc] RDMA/qedr: Fix qedr_create_user_qp error flow Kamal Heib
2024-02-07  2:42 ` [EXT] " Alok Prasad
2024-02-07  7:31 ` Leon Romanovsky
2024-02-08  0:01   ` Kamal Heib
2024-02-08  8:00     ` Leon Romanovsky [this message]

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=20240208080034.GC56027@unreal \
    --to=leon@kernel.org \
    --cc=aelior@marvell.com \
    --cc=jgg@ziepe.ca \
    --cc=kheib@redhat.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mkalderon@marvell.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.