From: Kamal Heib <kheib@redhat.com>
To: Leon Romanovsky <leon@kernel.org>
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: Wed, 7 Feb 2024 19:01:53 -0500 [thread overview]
Message-ID: <ZcQZ8cjtll07RQ2q@fedora-x1> (raw)
In-Reply-To: <20240207073114.GA56027@unreal>
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:
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
> >
> >
>
next prev parent reply other threads:[~2024-02-08 0:02 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 [this message]
2024-02-08 8:00 ` Leon Romanovsky
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=ZcQZ8cjtll07RQ2q@fedora-x1 \
--to=kheib@redhat.com \
--cc=aelior@marvell.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox