]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
tcp: do not mess with cloned skbs in tcp_add_backlog()
authorEric Dumazet <edumazet@google.com>
Tue, 19 Jan 2021 16:49:00 +0000 (08:49 -0800)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 19 Feb 2021 15:46:05 +0000 (16:46 +0100)
commit2a912bac774cdbca4bd500eddba8f4d78a9ebef6
treecb8ab07e9ab2468a200cf46e12ab717b71d49c4a
parent46b61d2109d8c26488b36f7d7b67d41d17e735bc
tcp: do not mess with cloned skbs in tcp_add_backlog()

BugLink: https://bugs.launchpad.net/bugs/1915195
commit b160c28548bc0a87cbd16d5af6d3edcfd70b8c9a upstream.

Heiner Kallweit reported that some skbs were sent with
the following invalid GSO properties :
- gso_size > 0
- gso_type == 0

This was triggerring a WARN_ON_ONCE() in rtl8169_tso_csum_v2.

Juerg Haefliger was able to reproduce a similar issue using
a lan78xx NIC and a workload mixing TCP incoming traffic
and forwarded packets.

The problem is that tcp_add_backlog() is writing
over gso_segs and gso_size even if the incoming packet will not
be coalesced to the backlog tail packet.

While skb_try_coalesce() would bail out if tail packet is cloned,
this overwriting would lead to corruptions of other packets
cooked by lan78xx, sharing a common super-packet.

The strategy used by lan78xx is to use a big skb, and split
it into all received packets using skb_clone() to avoid copies.
The drawback of this strategy is that all the small skb share a common
struct skb_shared_info.

This patch rewrites TCP gso_size/gso_segs handling to only
happen on the tail skb, since skb_try_coalesce() made sure
it was not cloned.

Fixes: 4f693b55c3d2 ("tcp: implement coalescing on backlog queue")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Bisected-by: Juerg Haefliger <juergh@canonical.com>
Tested-by: Juerg Haefliger <juergh@canonical.com>
Reported-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=209423
Link: https://lore.kernel.org/r/20210119164900.766957-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: William Breathitt Gray <william.gray@canonical.com>
net/ipv4/tcp_ipv4.c