Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2302021pxp; Mon, 21 Mar 2022 16:20:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0e5GTHhfyw9MTFi9IaPAXbKU/bAFaVan0MbgK5woTNTZKtCEpdOLCV26TAu/NHpIo4byq X-Received: by 2002:a17:902:e84b:b0:154:6222:98ae with SMTP id t11-20020a170902e84b00b00154622298aemr5982486plg.137.1647904815252; Mon, 21 Mar 2022 16:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647904815; cv=none; d=google.com; s=arc-20160816; b=DFcwIVX/LUFbfqK512RLsJqL8vE+lVUFXIOQTZCC8/FxDYTSM5szg6vRpWhWeHUk2H 3WkNBnJt2OBdld7cKvNV5q3LEfsWCEQwHEFfAvotu5Bi81m8rABZ7mOOfyTAyKAQfZpY ietC4NrLmNjticjqPBZ+zAKM/JIRU93t2ZvGDyU8BjJiAEZFJbHzO5NbaROerB0lxutq OMwf5flI66dJmIf3wpToMbWCguz3I5X31XRKi5WYyNexFhZQa4o6XU1cLT2tFmQqdNMU BhOjtSU05xeUqBUldZRGvexz8LP8s8zLRoqnSD64gZ5vthN9Nzwuq6yAUA8vcvjPZQzh uKfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3FihEp7dEvtbL1DgXgG3p5hK3l3ahKS9hMPiuMZzqtY=; b=QODBnFxtD1K4PwF8bjc9jsXm8g4h0OUUVsuEa2rcCbzFoYVsL20+jzED7tvCFgl7j9 hn6WaBsP+LsuKad3xSRQ0YAFzk/RhJRO71rnx67WhEOqeQEt9t+prTqMoDefhRfsX1Z+ /arR8AFDOaCoW0PIVBnfwndcaN/AYOLSC/1SiqtHV0GwatSSDzmWUcBFtnIUsvKzFCoF 2/e8//KJr+2OlL5exI+Fz1/UUfWQR63MFTELSrnv+i+G/1fOkEsgndxh/s44n9tELcMX DXt3qY/qxU3xcQSO6VRr/V/F0aGTw3L7TSikI/FIIbIqnwHA5Tvt6bxjW3Mp+3FGtHe6 54fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QtoCLTts; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d11-20020a65424b000000b003816043f0f3si12609912pgq.744.2022.03.21.16.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:20:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QtoCLTts; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C740746552B; Mon, 21 Mar 2022 15:19:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349691AbiCUOSj (ORCPT + 99 others); Mon, 21 Mar 2022 10:18:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348608AbiCUOHr (ORCPT ); Mon, 21 Mar 2022 10:07:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BF6B40A1C; Mon, 21 Mar 2022 07:02:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AB1BC61291; Mon, 21 Mar 2022 14:02:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B464CC340E8; Mon, 21 Mar 2022 14:02:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871334; bh=Rz97jaPjP8A5cEQQ+BaDGDxuBYyUviewzR5qgh6PjaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QtoCLTtsShC0xZAVE11m7DZfay7sC4LDVfYKAPEz+5fiwKeRLnojNShyvsWHE5ULZ XpsVgLvTH65m/thLSz+rFx66ZjWlUlaCv1j2sTikguZ13UU0uEAuv5V1YUE5/yqtVT cLu+oUF7VvScBXyCgc36zjih7HgRmsqlLCHGzCbE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Doug Berger , Florian Fainelli , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 24/37] net: bcmgenet: skip invalid partial checksums Date: Mon, 21 Mar 2022 14:53:06 +0100 Message-Id: <20220321133221.996805822@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133221.290173884@linuxfoundation.org> References: <20220321133221.290173884@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Doug Berger [ Upstream commit 0f643c88c8d240eba0ea25c2e095a46515ff46e9 ] The RXCHK block will return a partial checksum of 0 if it encounters a problem while receiving a packet. Since a 1's complement sum can only produce this result if no bits are set in the received data stream it is fair to treat it as an invalid partial checksum and not pass it up the stack. Fixes: 810155397890 ("net: bcmgenet: use CHECKSUM_COMPLETE for NETIF_F_RXCSUM") Signed-off-by: Doug Berger Acked-by: Florian Fainelli Link: https://lore.kernel.org/r/20220317012812.1313196-1-opendmb@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 87f1056e29ff..2da804f84b48 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -2287,8 +2287,10 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring, dma_length_status = status->length_status; if (dev->features & NETIF_F_RXCSUM) { rx_csum = (__force __be16)(status->rx_csum & 0xffff); - skb->csum = (__force __wsum)ntohs(rx_csum); - skb->ip_summed = CHECKSUM_COMPLETE; + if (rx_csum) { + skb->csum = (__force __wsum)ntohs(rx_csum); + skb->ip_summed = CHECKSUM_COMPLETE; + } } /* DMA flags and length are still valid no matter how -- 2.34.1