Received: by 10.223.185.111 with SMTP id b44csp909515wrg; Fri, 9 Mar 2018 16:36:32 -0800 (PST) X-Google-Smtp-Source: AG47ELut+W86cxnbdT6UcdFCS5k+bILGUpDsMajFIsCw5Ss45b4oWT/wxDomFlqPOF4uc69jCRVU X-Received: by 10.99.42.83 with SMTP id q80mr292687pgq.115.1520642192582; Fri, 09 Mar 2018 16:36:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520642192; cv=none; d=google.com; s=arc-20160816; b=pzalgC3gp2Ffi8o5Qmwx9bQE/c+GTrBefXNEBLAoWvp+bviKGF16GY2tJZ6PuNX5es rkvSyVFBlgltLbzdpZPacAhGrO0NRh8It2pJOWG7tuPMOq6aaqhSfBFmqHSx0O9S0AX3 oe6WYKH3hqPgXg8iFcxuUbu9I0ZpbHpyKqn9/TkzFQ8jYnNccHp3X23eP2D3AJd3hRgm CAlK4XyOCKKXDOccsabAePOLepRKkIJWS0ytCF4rqzcCTQyMhOdD6saJYm8f1IfKq31i RG3i2hU8VYyqa/2DgGGEhziPO01RBKw+4YZEhRblwHVir+ePQ9M8QkpTIRZtVlYb6BgI L1kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=4GtJyuHoh2E73h/B6sKwRNHvZcOjoNhCUhHXVuUr+rg=; b=rIyu85WEQnLISJeRz425mSmlWmX0z1vBcmEJzIuxg2orcaXK4kF6B9CF/Cmbelarfr XpDDyRnuBv72ccrzAMZ5nHsfDvU/A8fQI6YO/s16dpCpWaq1oCObLMJdnoR+TTEIQl+x dvvspuPAbyfSCsLVA1gluaIW63dXVcEZaiJSmwz8I8mkjF1e3ATocAM+ZfEGxrgTt+6n MApmmc1dRaLFt4GfT3fk1eE/dWOsUkvmfa2jOvRYlDq+j1vQm7EhDF9qcy2heJSxy1FJ XWckCK3i+j/tK9Jl1NeZJvAEDuLhuhLXvx3g08GaXfm7JbdwZYTjvF2gsdIMqA0ZOLX0 7xpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t75si1753178pfe.77.2018.03.09.16.36.18; Fri, 09 Mar 2018 16:36:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933848AbeCJAf1 (ORCPT + 99 others); Fri, 9 Mar 2018 19:35:27 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39854 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933819AbeCJAWF (ORCPT ); Fri, 9 Mar 2018 19:22:05 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B053EFE0; Sat, 10 Mar 2018 00:22:04 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Kodanev , "David S. Miller" Subject: [PATCH 4.9 41/65] udplite: fix partial checksum initialization Date: Fri, 9 Mar 2018 16:18:41 -0800 Message-Id: <20180310001828.311663703@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180310001824.927996722@linuxfoundation.org> References: <20180310001824.927996722@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexey Kodanev [ Upstream commit 15f35d49c93f4fa9875235e7bf3e3783d2dd7a1b ] Since UDP-Lite is always using checksum, the following path is triggered when calculating pseudo header for it: udp4_csum_init() or udp6_csum_init() skb_checksum_init_zero_check() __skb_checksum_validate_complete() The problem can appear if skb->len is less than CHECKSUM_BREAK. In this particular case __skb_checksum_validate_complete() also invokes __skb_checksum_complete(skb). If UDP-Lite is using partial checksum that covers only part of a packet, the function will return bad checksum and the packet will be dropped. It can be fixed if we skip skb_checksum_init_zero_check() and only set the required pseudo header checksum for UDP-Lite with partial checksum before udp4_csum_init()/udp6_csum_init() functions return. Fixes: ed70fcfcee95 ("net: Call skb_checksum_init in IPv4") Fixes: e4f45b7f40bd ("net: Call skb_checksum_init in IPv6") Signed-off-by: Alexey Kodanev Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/net/udplite.h | 1 + net/ipv4/udp.c | 5 +++++ net/ipv6/ip6_checksum.c | 5 +++++ 3 files changed, 11 insertions(+) --- a/include/net/udplite.h +++ b/include/net/udplite.h @@ -62,6 +62,7 @@ static inline int udplite_checksum_init( UDP_SKB_CB(skb)->cscov = cscov; if (skb->ip_summed == CHECKSUM_COMPLETE) skb->ip_summed = CHECKSUM_NONE; + skb->csum_valid = 0; } return 0; --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -1713,6 +1713,11 @@ static inline int udp4_csum_init(struct err = udplite_checksum_init(skb, uh); if (err) return err; + + if (UDP_SKB_CB(skb)->partial_cov) { + skb->csum = inet_compute_pseudo(skb, proto); + return 0; + } } /* Note, we are only interested in != 0 or == 0, thus the --- a/net/ipv6/ip6_checksum.c +++ b/net/ipv6/ip6_checksum.c @@ -72,6 +72,11 @@ int udp6_csum_init(struct sk_buff *skb, err = udplite_checksum_init(skb, uh); if (err) return err; + + if (UDP_SKB_CB(skb)->partial_cov) { + skb->csum = ip6_compute_pseudo(skb, proto); + return 0; + } } /* To support RFC 6936 (allow zero checksum in UDP/IPV6 for tunnels)