]> git.baikalelectronics.ru Git - kernel.git/commitdiff
tcp: also NULL skb->dev when copy was needed
authorFlorian Westphal <fw@strlen.de>
Fri, 20 Mar 2020 15:52:02 +0000 (16:52 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 21 Mar 2020 02:36:38 +0000 (19:36 -0700)
In rare cases retransmit logic will make a full skb copy, which will not
trigger the zeroing added in recent change
9d1edb708dd0 ("tcp: ensure skb->dev is NULL before leaving TCP stack").

Cc: Eric Dumazet <edumazet@google.com>
Fixes: 42899b27ca39 ("tcp: implement rb-tree based retransmit queue")
Fixes: 0a590088d50a ("netfilter: Support iif matches in POSTROUTING")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_output.c

index e8cf8fde3d37dc3b455224d33d0bde0e585f989e..2f45cde168c4abca8248fb835f79149260c7f418 100644 (file)
@@ -3041,8 +3041,12 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs)
 
                tcp_skb_tsorted_save(skb) {
                        nskb = __pskb_copy(skb, MAX_TCP_HEADER, GFP_ATOMIC);
-                       err = nskb ? tcp_transmit_skb(sk, nskb, 0, GFP_ATOMIC) :
-                                    -ENOBUFS;
+                       if (nskb) {
+                               nskb->dev = NULL;
+                               err = tcp_transmit_skb(sk, nskb, 0, GFP_ATOMIC);
+                       } else {
+                               err = -ENOBUFS;
+                       }
                } tcp_skb_tsorted_restore(skb);
 
                if (!err) {