Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2630336pxj; Mon, 31 May 2021 06:59:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxffKz4FioO+df8MDHhHsnoL28Fgga3JsCcJP85mVw/5al9mtv5EBilLrYpsTs1POVoCj9j X-Received: by 2002:a05:6638:270b:: with SMTP id m11mr20571910jav.59.1622469590158; Mon, 31 May 2021 06:59:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622469590; cv=none; d=google.com; s=arc-20160816; b=b34+uMf1RCn40a93PYWcWFD7xkxM1FA5Rf19rU4rTXzJ7MITuYdhw48OyLnA9TXBi4 dy+JTu5cNUIMYxVyheCge9tad74PYZUnhugx3fbDpI3icX410mESnzKrKn2Kt/7arcnQ kMTJFU8iD/8ASDLSg4RlqKhFAt5GErREIBclreyamjE0LH5ze9+UHLr6vKLPCCpwSUZr VA1mvD75r2IjxvncBdHBN8mpfkMcJ/owsOZnzKtlK6UdPdMW1sKhdFpLukWdE+mA7U5H EGpJva7CF8SPxDKHQ8YlbzKi6yFggBcLOSJhwjKvE6JPZ6hTRzXAQWMY/bU39HqFIukV KbcQ== 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=OxU3VMujqFKPVlXUSw+3G3UcqtTBT3GwJOop0REOP3w=; b=uWgZdU+ceXlR+0L/aUaIMjhNKgsWMuROHwsuPiyDKXOvUia3hdZtxlgjJB3E2MQE7B 1tkeMypGusdkDUMs6XX59ld0wyM/Wk67gt0ykk4vLcbj75uGyS3ZGPR8EwTA21vbYUdl 2PfGxumqagT1RNiK+jcHvTbbGfVt+hVRuhZKh8Ng3WluR50yEKwYSlyMGcSzD4io0uW2 j8F91tJe5TIoXYp0joTgCPxWehtUIV6TGbn7b7z0ul4jMRtn2+hgdQnhZ8ny2FmVFu60 49sLJztRpq3Jsw/9SxqJ+Kgov/W866/oqDkVTDieXLqsWtlaFjQRlYjpH3mwZrPHkw+C VIfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CCQWJWbE; 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 p31si16130158jac.95.2021.05.31.06.59.37; Mon, 31 May 2021 06:59:50 -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=CCQWJWbE; 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 S233020AbhEaN7R (ORCPT + 99 others); Mon, 31 May 2021 09:59:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:44078 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231935AbhEaNhZ (ORCPT ); Mon, 31 May 2021 09:37:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AE20261404; Mon, 31 May 2021 13:26:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467569; bh=sEQ2pVfC/wuxH4D2F2m0gKVgNHnaFOcCaEeW59XqaKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CCQWJWbElejaXgmkfWMUvvNyAWEGwz0RE66FbMExQSCcG0ceLrk/QTz0b94lxhKoH Dfc6EAtJclaY2RE7LoHaF9fHJLuMBK+wBkhz8laxjYV3kshVek6vc11ME+rax7FetC 9y8NKBuCDI5ezH0OmocT4JrvcgShmzKDgzeA5yNY= 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 4.19 115/116] net: hns3: check the return of skb_checksum_help() Date: Mon, 31 May 2021 15:14:51 +0200 Message-Id: <20210531130644.018184394@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130640.131924542@linuxfoundation.org> References: <20210531130640.131924542@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 @@ -702,8 +702,6 @@ static bool hns3_tunnel_csum_bug(struct if (!(!skb->encapsulation && l4.udp->dest == htons(IANA_VXLAN_PORT))) return false; - skb_checksum_help(skb); - return true; } @@ -764,8 +762,7 @@ static int hns3_set_l3l4_type_csum(struc /* 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); } l3.hdr = skb_inner_network_header(skb); @@ -796,7 +793,7 @@ static int hns3_set_l3l4_type_csum(struc break; case IPPROTO_UDP: if (hns3_tunnel_csum_bug(skb)) - break; + return skb_checksum_help(skb); hnae3_set_bit(*type_cs_vlan_tso, HNS3_TXD_L4CS_B, 1); hnae3_set_field(*type_cs_vlan_tso, @@ -821,8 +818,7 @@ static int hns3_set_l3l4_type_csum(struc /* 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;