From: Jason Gunthorpe <jgg@ziepe.ca>
To: Ryan Stone <rysto32@gmail.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: Race condition between cm_migrate() and cm_remove_one()
Date: Thu, 12 Nov 2020 15:46:38 -0400 [thread overview]
Message-ID: <20201112194638.GU244516@ziepe.ca> (raw)
In-Reply-To: <CAFMmRNx9cg--NUnZjFM8yWqFaEtsmAWV4EogKb3a0+hnjdtJFA@mail.gmail.com>
On Wed, Nov 04, 2020 at 05:08:59PM -0500, Ryan Stone wrote:
> If anybody could give input on my analysis and the proposed solution
> I'd really appreciate it.
Yikes, this whole thing is just wrong..
1) We can't migrate QP's across devices. So av and alt_av must be in the
same cm_dev, we never check this when forming the AV and alt AV's
during LAP. Wee
2) cm_remove_one needs to remove all the cm_dev's because it is going
to kfree them. Using altr_send_port_not_ready is foolish because
what we really want is to NULL the port pointer (we are freeing
that too)
3) Touching the AV after cm_remove_one(), eg for
rdma_destroy_ah_attr() is wrong. The AV is part of the cm_dev and
has to be cleaned up before the cm_remove_one can return.
4) The flush_workqueue() in cm_remove_one is wishful thinking, there
are many places still using the mad_agent that are not on that
workqueue.
A proper 'av_lock' rwsem going to be needed here
Which is another example of why every time I see some idiodic
'is_closed' flag it is just a sign of wrong, wrong, wrong.
Fixing it requires a full audit of all the places using the AV :\
Jason
prev parent reply other threads:[~2020-11-12 19:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-04 22:08 Race condition between cm_migrate() and cm_remove_one() Ryan Stone
2020-11-12 19:46 ` Jason Gunthorpe [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=20201112194638.GU244516@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=linux-rdma@vger.kernel.org \
--cc=rysto32@gmail.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).