From: Jason Gunthorpe <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
To: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Yuval Shaia <yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
RDMA mailing list
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Jack Morgenstein
<jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>,
Mark Bloch <markb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH rdma-next 2/5] RDMA/mlx5: Avoid memory leak in case of XRCD dealloc failure
Date: Sun, 28 Jan 2018 09:19:29 -0700 [thread overview]
Message-ID: <20180128161929.GJ23852@mellanox.com> (raw)
In-Reply-To: <20180128133755.GY1393-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
On Sun, Jan 28, 2018 at 03:37:55PM +0200, Leon Romanovsky wrote:
> On Sun, Jan 28, 2018 at 03:25:58PM +0200, Yuval Shaia wrote:
> > On Sun, Jan 28, 2018 at 02:52:08PM +0200, Leon Romanovsky wrote:
> > > On Sun, Jan 28, 2018 at 01:07:18PM +0200, Yuval Shaia wrote:
> > > > On Sun, Jan 28, 2018 at 11:25:30AM +0200, Leon Romanovsky wrote:
> > > > > From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > > > >
> > > > > Failure in XRCD FW deallocation command leaves memory leaked and
> > > > > returns error to the user which he can't do anything about it.
> > > > >
> > > > > This patch changes behavior to always free memory and always return
> > > > > success to the user.
> > > > >
> > > > > Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
> > > > > Reviewed-by: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > > > > Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > > > > drivers/infiniband/hw/mlx5/qp.c | 5 +----
> > > > > 1 file changed, 1 insertion(+), 4 deletions(-)
> > > > >
> > > > > diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
> > > > > index b06a2f9a8df4..39d24bf694a8 100644
> > > > > +++ b/drivers/infiniband/hw/mlx5/qp.c
> > > > > @@ -5066,13 +5066,10 @@ int mlx5_ib_dealloc_xrcd(struct ib_xrcd *xrcd)
> > > > > int err;
> > > > >
> > > > > err = mlx5_core_xrcd_dealloc(dev->mdev, xrcdn);
> > > > > - if (err) {
> > > > > + if (err)
> > > > > mlx5_ib_warn(dev, "failed to dealloc xrcdn 0x%x\n", xrcdn);
> > > > > - return err;
> > > > > - }
> > > > >
> > > > > kfree(xrcd);
> > > > > -
> > > > > return 0;
> > > >
> > > > In this case suggesting to make the function return void.
> > >
> > > It is part of global flow:
> > > ib_uverbs_dealloc_xrcd -> ib_dealloc_xrcd -> xrcd->device->dealloc_xrcd
> >
> > I see, missed that code path.
> >
> > But for my understanding, as of now - all implementations of this hook
> > (two) returns 0 always, right?
>
> Right, both mlx4 and mlx5 always return 0, and it is related to mistake
> in verbs API - various free and destroy functions return errors without
> actual need for it.
It would be nice to send another patch to remove the return code.
Long term I want to have all driver dealloc's unfailable..
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-01-28 16:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-28 9:25 [PATCH rdma-next 0/5] RDMA fixes for 4.16 Leon Romanovsky
[not found] ` <20180128092533.4156-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-01-28 9:25 ` [PATCH rdma-next 1/5] IB/umad: Fix use of unprotected device pointer Leon Romanovsky
2018-01-28 9:25 ` [PATCH rdma-next 2/5] RDMA/mlx5: Avoid memory leak in case of XRCD dealloc failure Leon Romanovsky
[not found] ` <20180128092533.4156-3-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-01-28 11:07 ` Yuval Shaia
2018-01-28 12:52 ` Leon Romanovsky
[not found] ` <20180128125208.GX1393-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2018-01-28 13:25 ` Yuval Shaia
2018-01-28 13:37 ` Leon Romanovsky
[not found] ` <20180128133755.GY1393-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2018-01-28 16:19 ` Jason Gunthorpe [this message]
2018-01-28 9:25 ` [PATCH rdma-next 3/5] IB/core: Avoid SGID attributes query while converting GID from OPA to IB Leon Romanovsky
[not found] ` <20180128092533.4156-4-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-01-28 11:11 ` Yuval Shaia
2018-01-28 9:25 ` [PATCH rdma-next 4/5] RDMA/cma: Use existing netif_is_bond_master function Leon Romanovsky
[not found] ` <20180128092533.4156-5-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-01-28 11:22 ` Yuval Shaia
2018-01-28 9:25 ` [PATCH rdma-next 5/5] RDMA/cm: Fix access to uninitialized variable Leon Romanovsky
[not found] ` <20180128092533.4156-6-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-01-28 11:38 ` Yuval Shaia
2018-01-28 21:12 ` [PATCH rdma-next 0/5] RDMA fixes for 4.16 Jason Gunthorpe
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=20180128161929.GJ23852@mellanox.com \
--to=jgg-vpraknaxozvwk0htik3j/w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
--cc=leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=markb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
/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