Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tcp: also NULL skb->dev when copy was needed

In rare cases retransmit logic will make a full skb copy, which will not
trigger the zeroing added in recent change
b738a185beaa ("tcp: ensure skb->dev is NULL before leaving TCP stack").

Cc: Eric Dumazet <edumazet@google.com>
Fixes: 75c119afe14f ("tcp: implement rb-tree based retransmit queue")
Fixes: 28f8bfd1ac94 ("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>

authored by

Florian Westphal and committed by
David S. Miller
07f8e4d0 702151da

+6 -2
+6 -2
net/ipv4/tcp_output.c
··· 3041 3041 3042 3042 tcp_skb_tsorted_save(skb) { 3043 3043 nskb = __pskb_copy(skb, MAX_TCP_HEADER, GFP_ATOMIC); 3044 - err = nskb ? tcp_transmit_skb(sk, nskb, 0, GFP_ATOMIC) : 3045 - -ENOBUFS; 3044 + if (nskb) { 3045 + nskb->dev = NULL; 3046 + err = tcp_transmit_skb(sk, nskb, 0, GFP_ATOMIC); 3047 + } else { 3048 + err = -ENOBUFS; 3049 + } 3046 3050 } tcp_skb_tsorted_restore(skb); 3047 3051 3048 3052 if (!err) {