From: Alex Timofeyev <sashka@ankey.net>
To: Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
linux-rdma@vger.kernel.org
Cc: Parav Pandit <parav@nvidia.com>,
Edward Srouji <edwards@nvidia.com>,
Vlad Dumitrescu <vdumitrescu@nvidia.com>,
stable@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH rdma-next v1 2/2] RDMA/cma: accept cross-NIC same-host local dst in validate_ipv6_net_dev
Date: Mon, 15 Jun 2026 17:46:19 +0000 [thread overview]
Message-ID: <1781545579.3-sashka@ankey.net> (raw)
In-Reply-To: <1781545579.1-sashka@ankey.net>
validate_ipv6_net_dev() confirms an incoming CM REQ was delivered on the
correct net_dev with an rt6_lookup() that requires
rt->rt6i_idev->dev == net_dev. For an IPv6 destination that is local to a
different netdev of the same host, the FIB resolves the lookup onto the
loopback netdev, so rt6i_idev->dev is lo regardless of which physical
netdev owns the listener address. The strict comparison then rejects the
REQ with -EHOSTUNREACH even though it was correctly delivered on net_dev.
Accept the request when the resolved route is RTF_LOCAL and net_dev itself
owns the address the listener was bound to (src_addr). This is the
receive-side counterpart to the cross-NIC same-host send-side fix in
addr_resolve_neigh().
Fixes: f887f2ac87c2 ("IB/cma: Validate routing of incoming requests")
Cc: stable@vger.kernel.org
Cc: Parav Pandit <parav@nvidia.com>
Signed-off-by: Alex Timofeyev <sashka@ankey.net>
---
drivers/infiniband/core/cma.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 9480d1a51c11..872c57943362 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1635,7 +1635,20 @@ static bool validate_ipv6_net_dev(struct net_device *net_dev,
if (!rt)
return false;
- ret = rt->rt6i_idev->dev == net_dev;
+ if (rt->rt6i_idev->dev == net_dev) {
+ ret = true;
+ } else if (rt->rt6i_flags & RTF_LOCAL) {
+ /* For a destination that is local to another netdev of the same
+ * host, the FIB collapses the lookup onto the loopback netdev,
+ * so rt6i_idev->dev is not net_dev even though the request was
+ * correctly delivered on net_dev. Accept it when net_dev itself
+ * owns the address we were listening on.
+ */
+ ret = ipv6_chk_addr(dev_net(net_dev), &src_addr->sin6_addr,
+ net_dev, 1);
+ } else {
+ ret = false;
+ }
ip6_rt_put(rt);
return ret;
--
2.40.4
next prev parent reply other threads:[~2026-06-15 17:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 17:46 [PATCH rdma-next v1 0/2] RDMA: fix cross-NIC same-host IPv6 RDMA-CM connect Alex Timofeyev
2026-06-15 17:46 ` [PATCH rdma-next v1 1/2] RDMA/core: use destination netdev MAC for cross-NIC same-host local dst Alex Timofeyev
2026-06-15 17:46 ` Alex Timofeyev [this message]
2026-06-15 23:59 ` [PATCH rdma-next v1 0/2] RDMA: fix cross-NIC same-host IPv6 RDMA-CM connect 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=1781545579.3-sashka@ankey.net \
--to=sashka@ankey.net \
--cc=edwards@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=parav@nvidia.com \
--cc=stable@vger.kernel.org \
--cc=vdumitrescu@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