From: Jason Gunthorpe <jgg@nvidia.com>
To: Patrisious Haddad <phaddad@nvidia.com>
Cc: Leon Romanovsky <leon@kernel.org>,
linux-rdma@vger.kernel.org, Maor Gottlieb <maorg@nvidia.com>,
Wei Chen <harperchen1110@gmail.com>
Subject: Re: [PATCH rdma-next] RDMA/core: Fix resolve_prepare_src error cleanup
Date: Mon, 12 Dec 2022 09:43:23 -0400 [thread overview]
Message-ID: <Y5cv+z6cYWUV3ara@nvidia.com> (raw)
In-Reply-To: <81008c63-50e0-075a-6795-71ea3d08803c@nvidia.com>
On Mon, Dec 12, 2022 at 03:42:07PM +0200, Patrisious Haddad wrote:
> I think we have the same realization but different understanding of the
> code, please correct what I'm missing, rest inline:
>
> On 12/12/2022 15:27, Jason Gunthorpe wrote:
> > On Sun, Dec 11, 2022 at 11:08:30AM +0200, Leon Romanovsky wrote:
> > > From: Patrisious Haddad <phaddad@nvidia.com>
> > >
> > > resolve_prepare_src() changes the destination address of the id,
> > > regardless of success, and on failure zeroes it out.
> > >
> > > Instead on function failure keep the original destination address
> > > of the id.
> > >
> > > Since the id could have been already added to the cm id tree and
> > > zeroing its destination address, could result in a key mismatch or
> > > multiple ids having the same key(zero) in the tree which could lead to:
> >
> > Oh, this can't be right
> >
> > The destination address is variable and it is changed by resolve even
> > in good cases.
> This is what I don't think can happen, since one address is resolved(bound),
> it can't be bound again so each an other try of resolve would fail and enter
> the error flow which I just fixed.
> >
> > So this part of the rb search is nonsense:
> >
> > result = compare_netdev_and_ip(
> > node_id_priv->id.route.addr.dev_addr.bound_dev_if,
> > cma_dst_addr(node_id_priv), this);
> >
> > The only way to fix it is to freeze the dst_addr before inserting
> > things into the rb tree.
> I completely agree, and this was my assumption that after resolve address,
> and resolve route(where I add to the tree), the dst_addr is frozen, the only
> scenario where it isn't was the resolve_prepare_src failure which some why
> nullified the value instead of keeping the original.
Then fix the control flow so it doesn't do the nullification if it
didn't change the value
You can't just change it while it is in the rb tree, that is racy
Jason
next prev parent reply other threads:[~2022-12-12 13:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-11 9:08 [PATCH rdma-next] RDMA/core: Fix resolve_prepare_src error cleanup Leon Romanovsky
2022-12-12 13:27 ` Jason Gunthorpe
2022-12-12 13:42 ` Patrisious Haddad
2022-12-12 13:43 ` Jason Gunthorpe [this message]
2022-12-12 13:55 ` Patrisious Haddad
2022-12-12 14:00 ` Jason Gunthorpe
2022-12-12 14:06 ` Patrisious Haddad
2022-12-12 20:15 ` 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=Y5cv+z6cYWUV3ara@nvidia.com \
--to=jgg@nvidia.com \
--cc=harperchen1110@gmail.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=maorg@nvidia.com \
--cc=phaddad@nvidia.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).