]> Git Repo - linux.git/commit
tcp: ensure skb->dev is NULL before leaving TCP stack
authorEric Dumazet <[email protected]>
Thu, 19 Mar 2020 19:49:55 +0000 (12:49 -0700)
committerDavid S. Miller <[email protected]>
Fri, 20 Mar 2020 04:35:55 +0000 (21:35 -0700)
commitb738a185beaab8728943acdb3e67371b8a88185e
tree83df18e962f606ec1966eb84b344e59f8f03d93a
parentf1f20a8666c55cb534b8f3fc1130eebf01a06155
tcp: ensure skb->dev is NULL before leaving TCP stack

skb->rbnode is sharing three skb fields : next, prev, dev

When a packet is sent, TCP keeps the original skb (master)
in a rtx queue, which was converted to rbtree a while back.

__tcp_transmit_skb() is responsible to clone the master skb,
and add the TCP header to the clone before sending it
to network layer.

skb_clone() already clears skb->next and skb->prev, but copies
the master oskb->dev into the clone.

We need to clear skb->dev, otherwise lower layers could interpret
the value as a pointer to a netdev.

This old bug surfaced recently when commit 28f8bfd1ac94
("netfilter: Support iif matches in POSTROUTING") was merged.

Before this netfilter commit, skb->dev value was ignored and
changed before reaching dev_queue_xmit()

Fixes: 75c119afe14f ("tcp: implement rb-tree based retransmit queue")
Fixes: 28f8bfd1ac94 ("netfilter: Support iif matches in POSTROUTING")
Signed-off-by: Eric Dumazet <[email protected]>
Reported-by: Martin Zaharinov <[email protected]>
Cc: Florian Westphal <[email protected]>
Cc: Pablo Neira Ayuso <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
net/ipv4/tcp_output.c
This page took 0.054204 seconds and 4 git commands to generate.