diff mbox series

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

Message ID 20180804204127.GC15082@ZenIV.linux.org.uk
State Accepted, archived
Delegated to: David Miller
Headers show
Series mellanox: fix the dport endianness in call of __inet6_lookup_established() | expand

Commit Message

Al Viro Aug. 4, 2018, 8:41 p.m. UTC
__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...
    
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---

Comments

David Miller Aug. 6, 2018, 12:27 a.m. UTC | #1
From: Al Viro <viro@ZenIV.linux.org.uk>
Date: Sat, 4 Aug 2018 21:41:27 +0100

> __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...
>     
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Mellanox folks, please review.
Boris Pismenny Aug. 6, 2018, 9:23 a.m. UTC | #2
On 8/6/2018 3:27 AM, David Miller wrote:
> From: Al Viro <viro@ZenIV.linux.org.uk>
> Date: Sat, 4 Aug 2018 21:41:27 +0100
> 
>> __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...
>>      
>> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> 
> Mellanox folks, please review.
> 

Looks good to me. Thanks Al.
David Miller Aug. 6, 2018, 5:32 p.m. UTC | #3
From: Al Viro <viro@ZenIV.linux.org.uk>
Date: Sat, 4 Aug 2018 21:41:27 +0100

> __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...
>     
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Applied to net-next, thanks Al.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c
index 92d37459850e..be137d4a9169 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c
@@ -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
 	}