Received: by 10.223.185.111 with SMTP id b44csp914919wrg; Fri, 9 Mar 2018 16:45:21 -0800 (PST) X-Google-Smtp-Source: AG47ELvbxeS16ljhVwHjS7sjrXpFA8FHYsKUFnLywACilwofsDZro7QXMz2V5Ou0IvvuiGbcHoA7 X-Received: by 10.99.0.207 with SMTP id 198mr321097pga.364.1520642721044; Fri, 09 Mar 2018 16:45:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520642721; cv=none; d=google.com; s=arc-20160816; b=MiOfVTzNKfq+QHY5gGhigGYsBGh2VvEaOR4fyRqa407aMYQWn4vtHZPByk926CGw7+ p/uobtrnpc1ZjsigQlbrS4IOMfhL7T3KTYlr9PaVmdJpBgFlRO0tIqUr8r8p4aFogXmV tgFcLcoewzHsqr1jzlrKrKg8mnktis720asdJMDSFmy6c11w4Q6fEuqrkCpB7xbkH6bt Gokt0CwxpXTKPMDy4thJChrblPpJqZ1OA4ryMWUVcLEy5y+nI5NaaK7mCKLvAZq2Fe7Z hu9sPfBXMsu73NJJou5lIKstuvQK1d8JNGJ/jsEV3toBcjLovqEVTxS2jwr2S/JPC4eI FlEw== 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=1yPXVAMJYGM0ljkIAy3P2iD7ZyG8ZPz3eCOq7KQJMY0=; b=Dahz/3HK3FIrEjtGYMBh+7cSxJc8Zc4BOOrKivyLRbW93WrDxw1tlWbRg0sL+10EA5 rtZanzu0qP8pHwVTHzirmyJ9/b37Yli+JzkgGZI12ywUl7NxPm7jsr/7yAMvYPEa+YxJ 0z+wmpUehI+15m/ls471x4ZNUzon2uD8dfIia/Zp1X0HBNPG6hYiscBFwQioP2QgafyH XE2Xi7zMbWcJuGIXTW1qGMkh1iugi3G7jnrPfBxWXhDGa7uC3BF4NmmeANRvADi5ciuI Ey/TibLchtW+UD9eiBbLW2yrSfAxDeOWuP3GVNsACpPY90ZiSs/w9D/dCwenmNesok4I mBNA== 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 i66si1476482pgc.445.2018.03.09.16.45.06; Fri, 09 Mar 2018 16:45:21 -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 S933482AbeCJAUk (ORCPT + 99 others); Fri, 9 Mar 2018 19:20:40 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39210 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933261AbeCJAUi (ORCPT ); Fri, 9 Mar 2018 19:20:38 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 944A2F26; Sat, 10 Mar 2018 00:20:37 +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.4 26/36] udplite: fix partial checksum initialization Date: Fri, 9 Mar 2018 16:18:42 -0800 Message-Id: <20180310001808.796588951@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180310001807.213987241@linuxfoundation.org> References: <20180310001807.213987241@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.4-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 @@ -1744,6 +1744,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; + } } return skb_checksum_init_zero_check(skb, proto, uh->check, --- a/net/ipv6/ip6_checksum.c +++ b/net/ipv6/ip6_checksum.c @@ -73,6 +73,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)