Skip to contentSkip to conversation

RDMA/cma: Use output interface for net_dev check

PATCH In review Håkon Bugge 2 participants 4 messages Oct 12, 2022 – Oct 13, 2022 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/cma: Use output interface for net_dev check

Commit 27cfde795a96 ("RDMA/cma: Fix arguments order in net device validation") swapped the src and dst addresses in the call to validate_net_dev().

As a consequence, the test in validate_ipv4_net_dev() to see if the net_dev is the right one, is incorrect for port 1 <-> 2 communication when the ports are on the same sub-net. This is fixed by denoting the flowi4_oif as the device instead of the incoming one.

The bug has not been observed using IPv6 addresses.

Fixes 27cfde795a96 ("RDMA/cma: Fix arguments order in net device validation")
---
 drivers/infiniband/core/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/cma.c +1 -1
index 925e1e7d1f1f3..2f95e12296fa2 100644
@@ -1634,7 +1634,7 @@ static bool validate_ipv4_net_dev(struct net_device *net_dev,
 		return false;
 
 	memset(&fl4, 0, sizeof(fl4));
-	fl4.flowi4_iif = net_dev->ifindex;
+	fl4.flowi4_oif = net_dev->ifindex;
 	fl4.daddr = daddr;
 	fl4.saddr = saddr;
 
Signature · 1 line
2.16.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Håkon Bugge

Commit 27cfde795a96 ("RDMA/cma: Fix arguments order in net device validation") swapped the src and dst addresses in the call to validate_net_dev().

As a consequence, the test in validate_ipv4_net_dev() to see if the net_dev is the right one, is incorrect for port 1 <-> 2 communication when the ports are on the same sub-net. This is fixed by denoting the flowi4_oif as the device instead of the incoming one.

Quoted 8 lines

The bug has not been observed using IPv6 addresses.

Fixes 27cfde795a96 ("RDMA/cma: Fix arguments order in net device validation")
---
 drivers/infiniband/core/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks,

#2 lore raw
Quoted 23 lines · Leon Romanovsky
Quoted 9 lines · Håkon Bugge

Commit 27cfde795a96 ("RDMA/cma: Fix arguments order in net device validation") swapped the src and dst addresses in the call to validate_net_dev().

As a consequence, the test in validate_ipv4_net_dev() to see if the net_dev is the right one, is incorrect for port 1 <-> 2 communication when the ports are on the same sub-net. This is fixed by denoting the flowi4_oif as the device instead of the incoming one.

Quoted 8 lines

The bug has not been observed using IPv6 addresses.

Fixes 27cfde795a96 ("RDMA/cma: Fix arguments order in net device validation")

---
drivers/infiniband/core/cma.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 2 lines

Thanks,

Thank you for your quick review Leon!

Håkon

#3 lore raw
Quoted 23 lines · Haakon Bugge
Quoted 23 lines · Leon Romanovsky
Quoted 17 lines · Håkon Bugge

Commit 27cfde795a96 ("RDMA/cma: Fix arguments order in net device validation") swapped the src and dst addresses in the call to validate_net_dev().

As a consequence, the test in validate_ipv4_net_dev() to see if the net_dev is the right one, is incorrect for port 1 <-> 2 communication when the ports are on the same sub-net. This is fixed by denoting the flowi4_oif as the device instead of the incoming one.

The bug has not been observed using IPv6 addresses.

Fixes 27cfde795a96 ("RDMA/cma: Fix arguments order in net device validation")

---
drivers/infiniband/core/cma.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 4 lines
Quoted 2 lines

Thanks,

Thank you for your quick review Leon!

Sure, just as a note. We won't take any patches before -rc1.

Thanks

Quoted 5 lines

Håkon