Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2714158pxj; Mon, 31 May 2021 08:55:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEIcRDdk9iiR6hY4csTrBoIE3016nIL8y6JY7X7ha6c+xBOmuLWSDjZT1HgVDKo5YQ1U/E X-Received: by 2002:a02:9542:: with SMTP id y60mr1283160jah.134.1622476540730; Mon, 31 May 2021 08:55:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622476540; cv=none; d=google.com; s=arc-20160816; b=yoINkA64spywHONcakK45e+M3WgJckJcS3KolcoHnP01ItT9CNpeU5/tgkVntLYG4k 0HctBKRn/U0w+qYv/4pSfs13JC6ayqIUR7vksI9x1Vr4D6255vSUzJ3bNmmgSY1AANS4 sBHZMXz61Cv5gkOxiqVNbxdpNYlr32+lpS32XBLaH4dGFEdjlrKtuokmpfaWd8+cs1oc yVbKeoWKK6LIrSZbyvOXzn3OYZl2Lqy1/pbdAhsqVmlCUE9D8zSn4f4LeTMxA1FLga1f Zc98sCkPCaKONzDyUwK9H3LHbeXaPNU45bHwTXxykA6O+pnc1vR2GEy3PbG1nBIT4qBr GhuA== 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=iST5NPz3By87mLq5vDQk9emyXu5dg2VzyXLm5vOrwgs=; b=OeFNCXHTJGvKwHPxEUnrzTkpNMRIT/8/jvR6qrlnfjISevR1S/kux/SJ8Do9epSnUG +F1knqNV0wtlo+t+Ob8ns1YmcZbwz4cTtOTumkoAEo2QMepgFqRBRA+09GQPJyXTN8mZ 0oegAq41lhqcYY7zieX9vbDH7yv/hE1dxdbxgNQH5cXGuvNQkcP0rlsgzhXiMps18+zt 8S4u13wxEfMG20rrK0jnwV0UwmHrCiK37IuvBOHILPG38mPGpspjve9JtRFouVqmfZ1d +78E2BesHH6AXx9AUiFbhsVi/0MsxZlTH+HSRe1yxlaLuJfMtfjLllW/NKTTpqerZE4h b9Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kxY6FClK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z22si14758281jal.117.2021.05.31.08.55.26; Mon, 31 May 2021 08:55:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kxY6FClK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233939AbhEaPyV (ORCPT + 99 others); Mon, 31 May 2021 11:54:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:56132 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233825AbhEaO33 (ORCPT ); Mon, 31 May 2021 10:29:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3187961C25; Mon, 31 May 2021 13:48:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468903; bh=uS8+4oKfWZJY8Y8Wuwo953RpPRVLkzyt/KFj9P9//+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kxY6FClKKi6SzRpSlhfnBlVVWCeQFlbF+/AWnKoKwigm0qhI+LuTOblYroaDITHLd MDpvJBj/alWfpcThIh1kFExSF91ZkB5cY8knKQRvvfabu5NDK/Q1Kgc4VGqoTvK/Sz jtN6SzqbyLjhxTw4MvqRJCoV6mzG9z8QivoY6jh4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunsheng Lin , Huazhong Tan , "David S. Miller" Subject: [PATCH 5.4 173/177] net: hns3: check the return of skb_checksum_help() Date: Mon, 31 May 2021 15:15:30 +0200 Message-Id: <20210531130653.913525384@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130647.887605866@linuxfoundation.org> References: <20210531130647.887605866@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunsheng Lin commit 9bb5a495424fd4bfa672eb1f31481248562fa156 upstream. Currently skb_checksum_help()'s return is ignored, but it may return error when it fails to allocate memory when linearizing. So adds checking for the return of skb_checksum_help(). Fixes: 76ad4f0ee747("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC") Fixes: 3db084d28dc0("net: hns3: Fix for vxlan tx checksum bug") Signed-off-by: Yunsheng Lin Signed-off-by: Huazhong Tan Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -810,8 +810,6 @@ static bool hns3_tunnel_csum_bug(struct l4.udp->dest == htons(4790)))) return false; - skb_checksum_help(skb); - return true; } @@ -889,8 +887,7 @@ static int hns3_set_l2l3l4(struct sk_buf /* the stack computes the IP header already, * driver calculate l4 checksum when not TSO. */ - skb_checksum_help(skb); - return 0; + return skb_checksum_help(skb); } hns3_set_outer_l2l3l4(skb, ol4_proto, ol_type_vlan_len_msec); @@ -935,7 +932,7 @@ static int hns3_set_l2l3l4(struct sk_buf break; case IPPROTO_UDP: if (hns3_tunnel_csum_bug(skb)) - break; + return skb_checksum_help(skb); hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4CS_B, 1); hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4T_S, @@ -960,8 +957,7 @@ static int hns3_set_l2l3l4(struct sk_buf /* the stack computes the IP header already, * driver calculate l4 checksum when not TSO. */ - skb_checksum_help(skb); - return 0; + return skb_checksum_help(skb); } return 0;