All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Patrisious Haddad <phaddad@nvidia.com>,
	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:27:25 -0400	[thread overview]
Message-ID: <Y5csPTRDNOIwf49T@nvidia.com> (raw)
In-Reply-To: <ec81a9d50462d9b9303966176b17b85f7dfbb96a.1670749660.git.leonro@nvidia.com>

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.

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.

ie completely block resolve_prepare_src()

Most probably this suggests that the id is being inserted into the
rbtree at the wrong time, before the dst_add becomes unchangable.

Jason

  reply	other threads:[~2022-12-12 13:27 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 [this message]
2022-12-12 13:42   ` Patrisious Haddad
2022-12-12 13:43     ` Jason Gunthorpe
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=Y5csPTRDNOIwf49T@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 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.