Received: by 10.223.185.116 with SMTP id b49csp5492821wrg; Wed, 7 Mar 2018 12:44:14 -0800 (PST) X-Google-Smtp-Source: AG47ELvTAH0tItT0mBlbAuV6Cgax6/dygASgiKwpFEd/Rnj248z87YE2XfxwvBvqnYpGVCEmTSbK X-Received: by 2002:a17:902:7883:: with SMTP id q3-v6mr21563291pll.361.1520455453973; Wed, 07 Mar 2018 12:44:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520455453; cv=none; d=google.com; s=arc-20160816; b=r9S8cv0MGQimiV0lDVaUwtjo7Cl3ZstrR4hhLeB+X4eHoZHtYeSan3v5aAnTRpm7ja deWVx04OFKLWXptGaZTUhJbKLaSsuDARqVNAm4NWGjz8RJipFiu8Avl7G1iS9vpr+4Zj mY61W9tavPxOY+YebRcJvs9ygz/TVY5d3kZdjwXZQXy0+dgKxPAWiNaOzvjl4DtXpXFm J0sQSd8W1dUtHJJh6gz+IIiVIuDZM5D5ZPd2vw+WeUQDCOjh+kv5OjXnJJNDhKIGw+cD 5woTJ7gFrA67Y1pBj6FsoKzJM12AG3xEUeEGSDHo8ETRkpVwtxsy4jeXpCvtWS/jWtkq P3bg== 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=zt3usaZtKk1wCalrDcbSFpjwa27FHn1bltb1yNaWi9M=; b=V5zZOB6ySa51qrPo3SidG5/AuL+1hgYXPnzxRYnDggAkVJ+8Fd3loSOMzF3BwJwsXx tRuw9+PTWZsAbU5PWGexcmCDRplXat97/Ojpd/vZlmfIFsi2XBG3ieVD1SmRhq2rMOuM JGA9QCFXW8qStfEXvK0f/H4qipxeRc/ore9cg0CljMU5MMeghk9MOkIpwBxLkYNMmFkX tgmlGcPPI3zgPhw7ZPdmP5Axet64XDQBP+bFQz+cJVqCuxG6B+FMDyBVWoFiEoHxNpPE +PGs59XaoKjvVzD/WdWC4P6b+UGEMOcEtLs4C2y8EBrlLdbgNu2YpEj5mLF1zrkziJkn SL1A== 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 s185si11856092pgc.718.2018.03.07.12.43.59; Wed, 07 Mar 2018 12:44:13 -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 S934725AbeCGTla (ORCPT + 99 others); Wed, 7 Mar 2018 14:41:30 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:41018 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934671AbeCGTlV (ORCPT ); Wed, 7 Mar 2018 14:41:21 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E9FC5FB3; Wed, 7 Mar 2018 19:41:20 +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.15 051/122] udplite: fix partial checksum initialization Date: Wed, 7 Mar 2018 11:37:43 -0800 Message-Id: <20180307191736.460270737@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191729.190879024@linuxfoundation.org> References: <20180307191729.190879024@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.15-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 @@ -64,6 +64,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 @@ -2031,6 +2031,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 @@ -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)