Commit 5fcd2d8b authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

tun: use sk_fullsock() before reading sk->sk_tsflags

timewait or request sockets are small and do not contain sk->sk_tsflags

Without this fix, we might read garbage, and crash later in

 -> sock_queue_err_skb()

(These pseudo sockets do not have an error queue either)

Fixes: ca6fb065 ("tcp: attach SYNACK messages to request sockets instead of listener")
Signed-off-by: default avatarEric Dumazet <>
Cc: Willem de Bruijn <>
Acked-by: default avatarMichael S. Tsirkin <>
Signed-off-by: default avatarDavid S. Miller <>
parent b7a46095
......@@ -858,7 +858,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC)))
goto drop;
if (skb->sk) {
if (skb->sk && sk_fullsock(skb->sk)) {
sock_tx_timestamp(skb->sk, &skb_shinfo(skb)->tx_flags);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment