Received: by 10.223.185.111 with SMTP id b44csp919420wrg; Fri, 9 Mar 2018 16:52:36 -0800 (PST) X-Google-Smtp-Source: AG47ELv7l7bg5PUpHM0TLbYyrAtE1Qk8SZwPEdEhoa6cSAyvBIncbnL58zBa9y/UJD2yGGgm3wC/ X-Received: by 10.99.175.78 with SMTP id s14mr317064pgo.388.1520643156772; Fri, 09 Mar 2018 16:52:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520643156; cv=none; d=google.com; s=arc-20160816; b=JtAdOwHtOkFrk8OaWUL628yqWapmYyCWDdU77WhF6rturDlH5+UM63orMwOHqL8L9c v2ozAUY+XJ1NTLlJfhq3XAiUgF6IavrwwOS/l8J9zEDxDByMsF7vVOx6nxKDUCbYKMKS 6SPqnnc+9OKPwuufCy1cMsBwN3uSImHnnCRmpoO0qKsC7y2WvEPv4Zed+HRSQK8IS9LR molhSaRz3lhACBa0jUHRaprV9XB/UVOGRsFZrN4DpDVSsXYSzs3TfuEIfaaZDZFu4XQo W+zbJin1aHCeU7BEM8hz43QM0o99K7nh+ZcqIJLTl0KGAVWN9Gw8KU/ei+GpCw9s8kl/ 6MyA== 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=A+PZuRXZqsVdW6GUV6XDc7/zIhXQRk+6JsahmrhuR0A=; b=VTsmgQDXAlLwW1KI/0PsalGu7odCt+IfzxEwd5kL/dVGDcRJW2ek4zXKNi8CUaQM0k GRXYyps7fhOJS+H2/+tT98irVpmG+rl71xYowR4zh8/mANYiUb+4/36bLyh9v8sCbni0 Gysg0xQAC/PnWC7twL7Zr+39GqxJPuBjeI65wYyK6mAPkPYnbSPXT6nOH/5nDOV/bxM1 Me4p5NGWBibRuj5VcTaLkt10AYUzINyS5OW5vCDdguUuhxWGZ2YXLcgCUotNBqRCuu8I VGDX1k3Uap0MPsNpdbMCoVxndRqBq3YrGJSvL9hNem98tnimRU5a+XZXo2M5cSHDQS+z 2Arw== 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 s21si1505512pgo.418.2018.03.09.16.52.22; Fri, 09 Mar 2018 16:52:36 -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 S933162AbeCJAvc (ORCPT + 99 others); Fri, 9 Mar 2018 19:51:32 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:38572 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932633AbeCJATQ (ORCPT ); Fri, 9 Mar 2018 19:19:16 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A21F4EF8; Sat, 10 Mar 2018 00:19:15 +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 3.18 14/21] udplite: fix partial checksum initialization Date: Fri, 9 Mar 2018 16:18:36 -0800 Message-Id: <20180310001801.920004050@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180310001801.045114869@linuxfoundation.org> References: <20180310001801.045114869@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 3.18-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 @@ -61,6 +61,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 @@ -1718,6 +1718,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)