Skip to content

Commit 41b14fb

Browse files
Tariq Toukandavem330
authored andcommitted
net: Do not clear the sock TX queue in sk_set_socket()
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 <[email protected]> Reviewed-by: Boris Pismenny <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4b973f4 commit 41b14fb

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

include/net/sock.h

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

18491849
static inline void sk_set_socket(struct sock *sk, struct socket *sock)
18501850
{
1851-
sk_tx_queue_clear(sk);
18521851
sk->sk_socket = sock;
18531852
}
18541853

net/core/sock.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
17671767
cgroup_sk_alloc(&sk->sk_cgrp_data);
17681768
sock_update_classid(&sk->sk_cgrp_data);
17691769
sock_update_netprioidx(&sk->sk_cgrp_data);
1770+
sk_tx_queue_clear(sk);
17701771
}
17711772

17721773
return sk;
@@ -1990,6 +1991,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
19901991
*/
19911992
sk_refcnt_debug_inc(newsk);
19921993
sk_set_socket(newsk, NULL);
1994+
sk_tx_queue_clear(newsk);
19931995
RCU_INIT_POINTER(newsk->sk_wq, NULL);
19941996

19951997
if (newsk->sk_prot->sockets_allocated)

0 commit comments

Comments
 (0)