Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2683423pxj; Mon, 31 May 2021 08:11:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxXQArvAPFbOVjS3mnvts2vtP9XLwYNLugNTeZFavN8ZPfcas9YzYQ1WvHIOTUwYG+K8Xy X-Received: by 2002:a05:6402:951:: with SMTP id h17mr26137988edz.212.1622473865530; Mon, 31 May 2021 08:11:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622473865; cv=none; d=google.com; s=arc-20160816; b=Slc/+M6hKgRgTyjs/Uroi+jAlyP+HGNO6hwz5gINL5W8j7F7S+iAvIEsMgtbY8xjet SyZKp+CAnL+6N7k2QrU/10Mch9UBA1D8hX0I+KrDfe3AfssRdAwUqRtqF2YK7ycfNdYT CrueJ3r9J6w0H8cHzNG7TPfKJio/GK6TsxllUfl0Yg3aC/OhB4Y1TDH969LK/xsbL1Sw SSb5/a+qz2/gWU61/1yYN0OuLfD75d24yapLN+lh7z7DdtACG01erN0SMglCJKHgosPm LTCKNSRVTUKBfkCJr1ORndYm256DPipEdLySyxBG04ZPwuqOWgGewpOfPt+UNa6lzihA +GxQ== 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=qVvPMzD2ljBYBcJ50iUW0O3khDwB7L20CMJJ3k/ZQ34=; b=pJYlBt3WBYGNo7lvXrv+7Y36KeY5fD+9JRFMIT5Bv6CvHsGTnTf1oKjUsOajfarXPu YcleduGg3O570wuBBn46/tn/Ja99EQkpoTTgPxrr0WSniMbxix5U9RREs9vkQCh4FDNZ ZQNxcUQHc/MnGblgkHgDEx43F5CNo4LCFoTIu/lVwVmuYzWoZ/9AEyrqP7Vj94VpsJxs DC+l28zA+O4yk3PQpTLAHwX2wK74/HvKkNBjeLh5CiiSEYX0TB4qeM4OqTdbmaS1T8yI 9fH6FURu6rnfT38u69tpwNMVtWNN2CV6GMp87omn8djy0Geq27+8dsQNNp/KlP/gdBXD 4dvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IJjuQvsa; 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 v8si12814051edc.533.2021.05.31.08.10.42; Mon, 31 May 2021 08:11:05 -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=IJjuQvsa; 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 S232224AbhEaPL1 (ORCPT + 99 others); Mon, 31 May 2021 11:11:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:39886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232920AbhEaOKb (ORCPT ); Mon, 31 May 2021 10:10:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B5F6161982; Mon, 31 May 2021 13:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468443; bh=WNWi9ETWNpjH0SogOcI22UVQ+IWwA1oLOtN8+tlbYRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IJjuQvsa/JVmNHC7YlUMgWNrB7HLFjFhqbcKQQKklgelFbXHUQsu40lfkeWYHoji3 jra+2FIo42+HFMR9WI3HpeJqc8W6zsWEtbUu9S+5so2OXgF4hGOvHJlFIYW2O7O3qY 2mS0l23OZNk4WDPRaxc6T+YxIIOvWiCiTTFtJexs= 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.10 245/252] net: hns3: check the return of skb_checksum_help() Date: Mon, 31 May 2021 15:15:10 +0200 Message-Id: <20210531130706.333682445@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@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 @@ -792,8 +792,6 @@ static bool hns3_tunnel_csum_bug(struct l4.udp->dest == htons(4790)))) return false; - skb_checksum_help(skb); - return true; } @@ -871,8 +869,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); @@ -917,7 +914,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, @@ -942,8 +939,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;