Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2459936imd; Fri, 2 Nov 2018 11:47:04 -0700 (PDT) X-Google-Smtp-Source: AJdET5d1Sgv+W2GHRbzAFxO9Bnt0qjWe+Kg8ihqkesnwUOL/s5G1nKrmO667iT/vr5A9VqMG41I4 X-Received: by 2002:a17:902:45a5:: with SMTP id n34-v6mr12960905pld.341.1541184424886; Fri, 02 Nov 2018 11:47:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541184424; cv=none; d=google.com; s=arc-20160816; b=ZbiRpAMfCk+eBP3Q5zOJyeUbSL+KfzNPkTdGjTLuWrfalY4T6c0WlzkddUsXg55cJk 5M5+op/mNClZ8idVIZQh6cNxHdPuqM13dxXokTSA9LnebtyDqAAGcX2bJfHqbvuX+unV v9M8SkNNXrLl19sGWRqKgwoQUW+RKDpzX5A96fDtL6kfTMEO+yU3sPXyxLBMbQkuarbE nokvm/odUpcEUzGMDaak00JNjc2HQENpBoZ5kqhrZCgmtIeZk6vVFf7ew2Lcb8qIdXZO R4JwYnAaomdc+u+9qWvRNAwyCE6/GvfB1S/gnYJr5085GeG761HBZwAAExrkW7ndO4aO 3wIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XaECv3H/nBc3gRbUptu3OOyfbhi27JyvdaVnhuV7J3U=; b=B+btUrA4XKiSFGt8uDNNTpmcoyVMzKA7gzGzPtPmU+TWzmWkiAx5bJwJ6UD/28lPGT 4TI3SgCH7KyKZRXKYI9fU4PYfi4vGy+d9UVBOEFjg81fw/lOpKpPUPmm4mD5EGY9UO1t k/8ndHte9XF6nVjtaZwuAFtsr2Cffn0UzZwXcIxLhpJ/qcYxDofUtsQjqKPBc81Y0y2K MEkbmjgmlM5tVm17RgssSJ3wJWBi4+HXmXiJDydAXEQ28W71Ps+DD28l+7C6vrZXEjvk T2qwy0dVyRdBYPYvhX9Q9JEvdyUqLs4KUs62e/LjcIMinBwMacASv15gTaeQVh2SwNpV /YJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0yJHtg2y; 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 m11-v6si36244631pla.408.2018.11.02.11.46.49; Fri, 02 Nov 2018 11:47:04 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=0yJHtg2y; 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 S1730260AbeKCDx7 (ORCPT + 99 others); Fri, 2 Nov 2018 23:53:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:49700 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729310AbeKCDx5 (ORCPT ); Fri, 2 Nov 2018 23:53:57 -0400 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DBEC120837; Fri, 2 Nov 2018 18:45:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541184344; bh=NIt/yhkdY82eJFlxUnd6EXtRkOmvlFRIEdOxqO/6Bnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0yJHtg2yXKnkL+FCynmE7jhfWhgifjqOrgOmq3ZdHBXS6OvMis/s0HY5e8ex7kQpI Lnu5zxoCU/AoLWfwh0dSFU7Fe/A2eF5IRWDjwn7HsRn/ZmAc2pGDcrZS+WoWtqF4LD ad2P0fCPygniI0NusNoqffDziYfZD+V5GDOT6bWM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dimitris Michailidis , Eric Dumazet , "David S. Miller" Subject: [PATCH 4.18 139/150] net: fix pskb_trim_rcsum_slow() with odd trim offset Date: Fri, 2 Nov 2018 19:35:01 +0100 Message-Id: <20181102182912.242049715@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181102182902.250560510@linuxfoundation.org> References: <20181102182902.250560510@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dimitris Michailidis [ Upstream commit d55bef5059dd057bd077155375c581b49d25be7e ] We've been getting checksum errors involving small UDP packets, usually 59B packets with 1 extra non-zero padding byte. netdev_rx_csum_fault() has been complaining that HW is providing bad checksums. Turns out the problem is in pskb_trim_rcsum_slow(), introduced in commit 88078d98d1bb ("net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends"). The source of the problem is that when the bytes we are trimming start at an odd address, as in the case of the 1 padding byte above, skb_checksum() returns a byte-swapped value. We cannot just combine this with skb->csum using csum_sub(). We need to use csum_block_sub() here that takes into account the parity of the start address and handles the swapping. Matches existing code in __skb_postpull_rcsum() and esp_remove_trailer(). Fixes: 88078d98d1bb ("net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends") Signed-off-by: Dimitris Michailidis Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/core/skbuff.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -1845,8 +1845,9 @@ int pskb_trim_rcsum_slow(struct sk_buff if (skb->ip_summed == CHECKSUM_COMPLETE) { int delta = skb->len - len; - skb->csum = csum_sub(skb->csum, - skb_checksum(skb, len, delta, 0)); + skb->csum = csum_block_sub(skb->csum, + skb_checksum(skb, len, delta, 0), + len); } return __pskb_trim(skb, len); }