[Devel] [PATCH RHEL7 COMMIT] net/skbuff: fix skb_clone()

Konstantin Khorenko khorenko at virtuozzo.com
Tue Jun 7 06:03:18 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.12
------>
commit d07c2786654a7bfe5d71ddcf71bf5889e82c12a2
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Tue Jun 7 17:03:18 2016 +0400

    net/skbuff: fix skb_clone()
    
    RHEL7 kernel backported 5a21232983aa ("net: Support for csum_bad in skbuff")
    That's a broken commit because skb_clone() leaves ->csum_bad field
    uninitialized. Later this leads to checksum failures
    (e.g. tcp_v4_rcv() -> skb_checksum_init()) and loosing packets.
    
    The upstream kernel is not affected by this, because the bug was silently
    fixed up by b19372273164 ("net: reorganize sk_buff for faster __copy_skb_header()")
    in the same kernel version.
    
    We don't want to backport b19372273164 because it changes KABI and we would
    like to avoid that. Instead, lets directly copy ->csum_bad along with
    ->csum_level and ->remcsum_offload fields which are also copied in the
    upstream kernel after b19372273164 commit.
    
    Note that we already have stepped on this in https://jira.sw.ru/browse/PSBM-38924
    but this wasn't properly fixed at the time.
    
    https://jira.sw.ru/browse/PSBM-47290
    
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
    Acked-by: Andrew Vagin <avagin at virtuozzo.com>
---
 net/core/skbuff.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 686ae59..7334046 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -817,6 +817,9 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
 	new->encap_hdr_csum	= old->encap_hdr_csum;
 	new->csum_valid		= old->csum_valid;
 	new->csum_complete_sw	= old->csum_complete_sw;
+	new->csum_bad		= old->csum_bad;
+	new->csum_level		= old->csum_level;
+	new->remcsum_offload	= old->remcsum_offload;
 #ifdef CONFIG_XFRM
 	new->sp			= secpath_get(old->sp);
 #endif


More information about the Devel mailing list