linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Tao Liu <thomas.liu@ucloud.cn>,
	dledford@redhat.com, haakon.bugge@oracle.com, shayd@nvidia.com,
	avihaih@nvidia.com, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org, thomas.liu@ucloud.com
Subject: Re: [PATCH] RDMA/cma: Fix listener leak in rdma_cma_listen_on_all() failure
Date: Thu, 16 Sep 2021 10:57:12 -0300	[thread overview]
Message-ID: <20210916135712.GA327412@nvidia.com> (raw)
In-Reply-To: <YUEtpNgI+Z8ksQjC@unreal>

On Wed, Sep 15, 2021 at 02:17:56AM +0300, Leon Romanovsky wrote:

> > +static void cma_cancel_listens(struct rdma_id_private *id_priv)
> > +{
> > +	/*
> > +	 * During _destroy_id() it is not possible for this value to transition
> > +	 * from empty to !empty, test it outside to lock to avoid taking a
> > +	 * global lock on every destroy. Only listen all cases will have
> > +	 * something to do
> > +	 */
> > +	if (list_empty(&id_priv->list))
> > +		return;
> 
> IMHO, it is better do not do such check outside of the lock without real
> gain. It is too subtle to rely on _destroy_id() behaviour.

This arrangement would have solved the syzkaller bugs that are
triggering due to the other logic in _destroy_id() being too subtle
already :\

But it can't be done because priv->list is a total mess

Jason

  reply	other threads:[~2021-09-16 13:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13  9:33 [PATCH] RDMA/cma: Fix listener leak in rdma_cma_listen_on_all() failure Tao Liu
2021-09-13 11:16 ` Leon Romanovsky
2021-09-14 19:54 ` Jason Gunthorpe
2021-09-14 23:17   ` Leon Romanovsky
2021-09-16 13:57     ` Jason Gunthorpe [this message]
2021-09-15  6:34   ` Mark Zhang
2021-09-15 13:18     ` 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=20210916135712.GA327412@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=avihaih@nvidia.com \
    --cc=dledford@redhat.com \
    --cc=haakon.bugge@oracle.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=shayd@nvidia.com \
    --cc=thomas.liu@ucloud.cn \
    --cc=thomas.liu@ucloud.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;
as well as URLs for NNTP newsgroup(s).