Skip to content

Commit ab45808

Browse files
msanallagregkh
authored andcommitted
RDMA/core: Fix broadcast address falsely detected as local
commit 942cd47 upstream. 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. Link: https://patch.msgid.link/r/20260609-fix-rdma-resolve-addr-v1-1-449b8b4e6c09@nvidia.com Cc: stable@vger.kernel.org Fixes: c31e403 ("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> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5a45d0a commit ab45808

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/infiniband/core/addr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ static int addr6_resolve(struct sockaddr *src_sock,
439439
static bool is_dst_local(const struct dst_entry *dst)
440440
{
441441
if (dst->ops->family == AF_INET)
442-
return !!(dst_rtable(dst)->rt_type & RTN_LOCAL);
442+
return dst_rtable(dst)->rt_type == RTN_LOCAL;
443443
else if (dst->ops->family == AF_INET6)
444444
return !!(dst_rt6_info(dst)->rt6i_flags & RTF_LOCAL);
445445
else

0 commit comments

Comments
 (0)