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

Andrew Vagin avagin at virtuozzo.com
Mon Jun 6 14:43:21 PDT 2016


On Mon, Jun 06, 2016 at 06:22:34PM +0300, Andrey Ryabinin wrote:
> 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
> 

Acked-by: Andrew Vagin <avagin at virtuozzo.com>

Thanks

> Signed-off-by: Andrey Ryabinin <aryabinin 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
> -- 
> 2.7.3
> 


More information about the Devel mailing list