* [PATCH rdma-next] RDMA/core: Fix broadcast address falsely detected as local
@ 2026-06-09 11:16 Edward Srouji
2026-06-09 12:48 ` Parav Pandit
2026-06-10 18:03 ` Jason Gunthorpe
0 siblings, 2 replies; 3+ messages in thread
From: Edward Srouji @ 2026-06-09 11:16 UTC (permalink / raw)
To: Jason Gunthorpe, Leon Romanovsky, Parav Pandit, Vlad Dumitrescu
Cc: linux-rdma, linux-kernel, Maher Sanalla, stable, Edward Srouji
From: Maher Sanalla <msanalla@nvidia.com>
When rdma_resolve_addr() is invoked with a broadcast destination on an
IPoIB interface, is_dst_local() inspects the resolved route and
incorrectly concludes that the address is local. As a result, the
resolution fails with -ENODEV.
The issue stems from using '&' to compare rt_type with RTN_LOCAL. The
RTN_* values form a sequential enum, not a bitmask (RTN_LOCAL=2,
RTN_BROADCAST=3). Thus, "rt_type & RTN_LOCAL" yields a non-zero result
for a broadcast route as well.
Replace '&' with '==' when comparing rt_type against RTN_LOCAL.
Cc: stable@vger.kernel.org
Fixes: c31e4038c97f ("RDMA/core: Use route entry flag to decide on loopback traffic")
Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
Reviewed-by: Vlad Dumitrescu <vdumitrescu@nvidia.com>
Signed-off-by: Edward Srouji <edwards@nvidia.com>
---
drivers/infiniband/core/addr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 7e62b5b1ffaa364ce0720a09084beca5f4db95a5..e9fb7ad4c377cfe4605b12ed4b4be2e5dba7eb13 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -438,7 +438,7 @@ static int addr6_resolve(struct sockaddr *src_sock,
static bool is_dst_local(const struct dst_entry *dst)
{
if (dst->ops->family == AF_INET)
- return !!(dst_rtable(dst)->rt_type & RTN_LOCAL);
+ return dst_rtable(dst)->rt_type == RTN_LOCAL;
else if (dst->ops->family == AF_INET6)
return !!(dst_rt6_info(dst)->rt6i_flags & RTF_LOCAL);
else
---
base-commit: ea4f6f6c53577fb3f05dbd78b15e586772d49831
change-id: 20260609-fix-rdma-resolve-addr-1ce615248b6a
Best regards,
--
Edward Srouji <edwards@nvidia.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [PATCH rdma-next] RDMA/core: Fix broadcast address falsely detected as local
2026-06-09 11:16 [PATCH rdma-next] RDMA/core: Fix broadcast address falsely detected as local Edward Srouji
@ 2026-06-09 12:48 ` Parav Pandit
2026-06-10 18:03 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Parav Pandit @ 2026-06-09 12:48 UTC (permalink / raw)
To: Edward Srouji, Jason Gunthorpe, Leon Romanovsky, Vlad Dumitrescu
Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
Maher Sanalla, stable@vger.kernel.org
> From: Edward Srouji <edwards@nvidia.com>
> Sent: 09 June 2026 04:47 PM
>
> From: Maher Sanalla <msanalla@nvidia.com>
>
> When rdma_resolve_addr() is invoked with a broadcast destination on an
> IPoIB interface, is_dst_local() inspects the resolved route and
> incorrectly concludes that the address is local. As a result, the
> resolution fails with -ENODEV.
> The issue stems from using '&' to compare rt_type with RTN_LOCAL. The
> RTN_* values form a sequential enum, not a bitmask (RTN_LOCAL=2,
> RTN_BROADCAST=3). Thus, "rt_type & RTN_LOCAL" yields a non-zero result
> for a broadcast route as well.
>
> Replace '&' with '==' when comparing rt_type against RTN_LOCAL.
>
> Cc: stable@vger.kernel.org
> Fixes: c31e4038c97f ("RDMA/core: Use route entry flag to decide on loopback traffic")
> Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
> Reviewed-by: Vlad Dumitrescu <vdumitrescu@nvidia.com>
> Signed-off-by: Edward Srouji <edwards@nvidia.com>
> ---
> drivers/infiniband/core/addr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
> index 7e62b5b1ffaa364ce0720a09084beca5f4db95a5..e9fb7ad4c377cfe4605b12ed4b4be2e5dba7eb13 100644
> --- a/drivers/infiniband/core/addr.c
> +++ b/drivers/infiniband/core/addr.c
> @@ -438,7 +438,7 @@ static int addr6_resolve(struct sockaddr *src_sock,
> static bool is_dst_local(const struct dst_entry *dst)
> {
> if (dst->ops->family == AF_INET)
> - return !!(dst_rtable(dst)->rt_type & RTN_LOCAL);
> + return dst_rtable(dst)->rt_type == RTN_LOCAL;
> else if (dst->ops->family == AF_INET6)
> return !!(dst_rt6_info(dst)->rt6i_flags & RTF_LOCAL);
> else
>
> ---
> base-commit: ea4f6f6c53577fb3f05dbd78b15e586772d49831
> change-id: 20260609-fix-rdma-resolve-addr-1ce615248b6a
>
> Best regards,
> --
> Edward Srouji <edwards@nvidia.com>
Reviewed-by: Parav Pandit <parav@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH rdma-next] RDMA/core: Fix broadcast address falsely detected as local
2026-06-09 11:16 [PATCH rdma-next] RDMA/core: Fix broadcast address falsely detected as local Edward Srouji
2026-06-09 12:48 ` Parav Pandit
@ 2026-06-10 18:03 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2026-06-10 18:03 UTC (permalink / raw)
To: Edward Srouji
Cc: Leon Romanovsky, Parav Pandit, Vlad Dumitrescu, linux-rdma,
linux-kernel, Maher Sanalla, stable
On Tue, Jun 09, 2026 at 02:16:38PM +0300, Edward Srouji wrote:
> From: Maher Sanalla <msanalla@nvidia.com>
>
> When rdma_resolve_addr() is invoked with a broadcast destination on an
> IPoIB interface, is_dst_local() inspects the resolved route and
> incorrectly concludes that the address is local. As a result, the
> resolution fails with -ENODEV.
> The issue stems from using '&' to compare rt_type with RTN_LOCAL. The
> RTN_* values form a sequential enum, not a bitmask (RTN_LOCAL=2,
> RTN_BROADCAST=3). Thus, "rt_type & RTN_LOCAL" yields a non-zero result
> for a broadcast route as well.
>
> Replace '&' with '==' when comparing rt_type against RTN_LOCAL.
>
> Cc: stable@vger.kernel.org
> Fixes: c31e4038c97f ("RDMA/core: Use route entry flag to decide on loopback traffic")
> Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
> Reviewed-by: Vlad Dumitrescu <vdumitrescu@nvidia.com>
> Signed-off-by: Edward Srouji <edwards@nvidia.com>
> Reviewed-by: Parav Pandit <parav@nvidia.com>
> ---
> drivers/infiniband/core/addr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to for-next
Thanks,
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-10 18:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-09 11:16 [PATCH rdma-next] RDMA/core: Fix broadcast address falsely detected as local Edward Srouji
2026-06-09 12:48 ` Parav Pandit
2026-06-10 18:03 ` Jason Gunthorpe
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.