All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Yishai Hadas <yishaih@dev.mellanox.co.il>
Cc: Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@mellanox.com>, Lijun Ou <oulijun@huawei.com>,
	linux-rdma@vger.kernel.org,
	Potnuri Bharat Teja <bharat@chelsio.com>,
	Weihang Li <liweihang@huawei.com>,
	"Wei Hu(Xavier)" <huwei87@hisilicon.com>,
	Yishai Hadas <yishaih@mellanox.com>,
	Maor Gottlieb <maorg@mellanox.com>
Subject: Re: [PATCH rdma-next 2/5] RDMA: Clean MW allocation and free flows
Date: Sun, 28 Jun 2020 12:55:32 +0300	[thread overview]
Message-ID: <20200628095532.GD6281@unreal> (raw)
In-Reply-To: <f5ffa1d5-d665-4913-ec40-1e6ad42685fc@dev.mellanox.co.il>

On Sun, Jun 28, 2020 at 12:18:38PM +0300, Yishai Hadas wrote:
> On 6/24/2020 1:54 PM, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@mellanox.com>
> >
> > Move allocation and destruction of memory windows under ib_core
> > responsibility and clean drivers to ensure that no updates to MW
> > ib_core structures are done in driver layer.
> >
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > ---

<...>

> > +void mlx5_ib_dealloc_mw(struct ib_mw *mw)
> >   {
> >   	struct mlx5_ib_dev *dev = to_mdev(mw->device);
> >   	struct mlx5_ib_mw *mmw = to_mmw(mw);
> > -	int err;
> >   	if (IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING)) {
> >   		xa_erase(&dev->odp_mkeys, mlx5_base_mkey(mmw->mmkey.key));
> > @@ -2073,11 +2067,7 @@ int mlx5_ib_dealloc_mw(struct ib_mw *mw)
> >   		synchronize_srcu(&dev->odp_srcu);
> >   	}
> > -	err = mlx5_core_destroy_mkey(dev->mdev, &mmw->mmkey);
> > -	if (err)
> > -		return err;
> > -	kfree(mmw);
> > -	return 0;
> > +	mlx5_core_destroy_mkey(dev->mdev, &mmw->mmkey);
>
> Are we fully sure that this can never be triggered by user space to fail as
> of the property of the MW that can be binded with bypassing kernel ? the new
> code just ignored the err.

Why is it different from any other HW object?
The failure to destroy will leave leaked kernel resources.

We already removed this mmkey from xarray above and if we don't finish,
the MW will be leaked.

Thanks

  reply	other threads:[~2020-06-28  9:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-24 10:54 [PATCH rdma-next 0/5] ib_core allocation patches Leon Romanovsky
2020-06-24 10:54 ` [PATCH rdma-next 1/5] RDMA/core: Create and destroy counters in the ib_core Leon Romanovsky
2020-06-24 10:54 ` [PATCH rdma-next 2/5] RDMA: Clean MW allocation and free flows Leon Romanovsky
2020-06-28  9:18   ` Yishai Hadas
2020-06-28  9:55     ` Leon Romanovsky [this message]
2020-06-24 10:54 ` [PATCH rdma-next 3/5] RDMA: Move XRCD to be under ib_core responsibility Leon Romanovsky
2020-06-24 10:54 ` [PATCH rdma-next 4/5] RDMA/core: Delete not-used create RWQ table function Leon Romanovsky
2020-06-24 19:46   ` Jason Gunthorpe
2020-06-24 10:54 ` [PATCH rdma-next 5/5] RDMA/core: Convert RWQ table logic to ib_core allocation scheme Leon Romanovsky
2020-06-28  9:11   ` Yishai Hadas
2020-06-28  9:41     ` Leon Romanovsky
2020-06-28 10:08       ` Yishai Hadas
2020-06-28 10:33         ` Leon Romanovsky
2020-06-28 11:55           ` Yishai Hadas
2020-06-28 13:10             ` Leon Romanovsky
2020-06-29 15:39   ` Jason Gunthorpe
2020-06-30  7:21     ` Leon Romanovsky
2020-06-30 11:37       ` Jason Gunthorpe
2020-06-30 11:52         ` Leon Romanovsky
2020-06-30 12:06           ` Jason Gunthorpe
2020-06-30 12:13             ` 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=20200628095532.GD6281@unreal \
    --to=leon@kernel.org \
    --cc=bharat@chelsio.com \
    --cc=dledford@redhat.com \
    --cc=huwei87@hisilicon.com \
    --cc=jgg@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=liweihang@huawei.com \
    --cc=maorg@mellanox.com \
    --cc=oulijun@huawei.com \
    --cc=yishaih@dev.mellanox.co.il \
    --cc=yishaih@mellanox.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.