Skip to contentSkip to conversation

mellanox: fix the dport endianness in call of __inet6_lookup_established()

PATCH Applied Al Viro 3 participants 4 messages Aug 4, 2018 – Aug 6, 2018

Subsystems (4)
lore
Share & tools
lore

Al Viro

author
#0 lore raw

PATCH 1/1 mellanox: fix the dport endianness in call of __inet6_lookup_established()

__inet6_lookup_established() expect th->dport passed in host-endian, not net-endian. The reason is microoptimization in __inet6_lookup(), but if you use the lower-level helpers, you have to play by their rules...

---

drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c +1 -1
index 92d37459850e..be137d4a9169 100644
@@ -328,7 +328,7 @@ static int tls_update_resync_sn(struct net_device *netdev,
 
 		sk = __inet6_lookup_established(dev_net(netdev), &tcp_hashinfo,
 						&ipv6h->saddr, th->source,
-						&ipv6h->daddr, th->dest,
+						&ipv6h->daddr, ntohs(th->dest),
 						netdev->ifindex, 0);
 #endif
 	}
maintainer
#1 lore raw

From: Al Viro <[email protected]>
Date: Sat, 4 Aug 2018 21:41:27 +0100

Quoted 6 lines

__inet6_lookup_established() expect th->dport passed in host-endian, not net-endian. The reason is microoptimization in __inet6_lookup(), but if you use the lower-level helpers, you have to play by their rules...

Mellanox folks, please review.

#2 lore raw
Quoted 12 lines · David Miller

From: Al Viro <[email protected]>
Date: Sat, 4 Aug 2018 21:41:27 +0100

Quoted 6 lines

__inet6_lookup_established() expect th->dport passed in host-endian, not net-endian. The reason is microoptimization in __inet6_lookup(), but if you use the lower-level helpers, you have to play by their rules...

Mellanox folks, please review.

Looks good to me. Thanks Al.

maintainer Applied
#3 lore raw
In reply to Al Viro

From: Al Viro <[email protected]>
Date: Sat, 4 Aug 2018 21:41:27 +0100

Quoted 6 lines

__inet6_lookup_established() expect th->dport passed in host-endian, not net-endian. The reason is microoptimization in __inet6_lookup(), but if you use the lower-level helpers, you have to play by their rules...

Applied to net-next, thanks Al.