Received: by 10.223.185.116 with SMTP id b49csp5461033wrg; Wed, 7 Mar 2018 12:09:05 -0800 (PST) X-Google-Smtp-Source: AG47ELsLJ19VdCSh2bqgWis2vuiBRksSN+VjK9MVMHboZL4GrnYAO0VzHWwNMe4NVp70FeT20T6Q X-Received: by 10.99.121.140 with SMTP id u134mr18687265pgc.89.1520453345754; Wed, 07 Mar 2018 12:09:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520453345; cv=none; d=google.com; s=arc-20160816; b=aef+u2a+q+UXrLcxab/oShPbFugVoJ1p4j9MBQknTe1ta9DmUfNfjZpWM/loU8F+SN TALFczKeijfotC2SUAdj/vQcjLRDoW3rpeD8PwpvtmYQAXLVZDybtV40KpbsfoDx8swp F3JN9esadCu7St80I9zwJYFOPMq7Oi+t+hzQAxBYWl9UJl9HePAVzQXg28RwTtRpFpBc GwbEYpqk+NziYwuov57gfLpOtgfcHqkMOPHF7DA/yUMjRlhbjCz2MTy6j+LhPG1pgoSc qNaUcMvW446BOoB9QfsIT/9lh9gQsCxJn6np7cdGXRsdCQmpiBMP9v+jTOevarFctDza Yn3w== 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=YdbJhbYDuh0cyoQpx4MiP74rC7UKei8WwO8cL9qHalA=; b=IjHEBKxM0XkDIHjbAWMYyXiZCeIBIrKwUQCv+PGcHXNXbEJ2e7lEW91rSpV5yGEYFk PTpem2TB1rAMNum4O6Rkx85zVRqAlyTQ0zEYbWpNdoFxvomWC8OTF9fsVxqqHoBjn046 HMbkkJjsPD4p1yzBhuLhf5OqVsQJOixUljrXkzCUiud0o4XLhhW0J1SzcmZW4yFcdfAt t9E5B4j/s+5aMNTt5z7Wom99Ngq9lj8Ni3nwMiBu7QVBYszXYbboKMH/kSQGfMi4barY e+5h/HAF+oT24jMBTsviFoFCHVVlwyufgqi2sWu34Wgtw+12tQqt217r2sAxNBD7pFkO kFeA== 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 q4si11793443pgc.269.2018.03.07.12.08.51; Wed, 07 Mar 2018 12:09:05 -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 S965482AbeCGUHY (ORCPT + 99 others); Wed, 7 Mar 2018 15:07:24 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:44388 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965422AbeCGTp5 (ORCPT ); Wed, 7 Mar 2018 14:45:57 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C27EBF8A; Wed, 7 Mar 2018 19:45:56 +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.14 046/110] udplite: fix partial checksum initialization Date: Wed, 7 Mar 2018 11:38:29 -0800 Message-Id: <20180307191045.610732732@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191039.748351103@linuxfoundation.org> References: <20180307191039.748351103@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.14-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 @@ -2032,6 +2032,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)