Skip to content

Commit 68357eb

Browse files
Tariq ToukanSasha Levin
authored andcommitted
net: Do not clear the sock TX queue in sk_set_socket()
[ Upstream commit 41b14fb ] Clearing the sock TX queue in sk_set_socket() might cause unexpected out-of-order transmit when called from sock_orphan(), as outstanding packets can pick a different TX queue and bypass the ones already queued. This is undesired in general. More specifically, it breaks the in-order scheduling property guarantee for device-offloaded TLS sockets. Remove the call to sk_tx_queue_clear() in sk_set_socket(), and add it explicitly only where needed. Fixes: e022f0b ("net: Introduce sk_tx_queue_mapping") Signed-off-by: Tariq Toukan <tariqt@mellanox.com> Reviewed-by: Boris Pismenny <borisp@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6d0527f commit 68357eb

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎include/net/sock.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,6 @@ static inline int sk_rx_queue_get(const struct sock *sk)
18461846

18471847
static inline void sk_set_socket(struct sock *sk, struct socket *sock)
18481848
{
1849-
sk_tx_queue_clear(sk);
18501849
sk->sk_socket = sock;
18511850
}
18521851

‎net/core/sock.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
16781678
cgroup_sk_alloc(&sk->sk_cgrp_data);
16791679
sock_update_classid(&sk->sk_cgrp_data);
16801680
sock_update_netprioidx(&sk->sk_cgrp_data);
1681+
sk_tx_queue_clear(sk);
16811682
}
16821683

16831684
return sk;
@@ -1901,6 +1902,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
19011902
*/
19021903
sk_refcnt_debug_inc(newsk);
19031904
sk_set_socket(newsk, NULL);
1905+
sk_tx_queue_clear(newsk);
19041906
RCU_INIT_POINTER(newsk->sk_wq, NULL);
19051907

19061908
if (newsk->sk_prot->sockets_allocated)

0 commit comments

Comments
 (0)