Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2752774pxj; Mon, 31 May 2021 09:52:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6sn7rhbhI0OYSoQAL1432aW0oQrb0kfWFPhk/RWyhIS2NfAvldiyDGxHD6LSQtp4G8vmM X-Received: by 2002:aa7:c9ce:: with SMTP id i14mr26372611edt.148.1622479931718; Mon, 31 May 2021 09:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622479931; cv=none; d=google.com; s=arc-20160816; b=OtUjsq5XvQko5oAy/osdjbBQRmPCRdOAfF9OivnScG3++2ayj0FFyF43pcLYLwCPcX X8q8EfBIWKSNBsucrrz+rNwGpbuPlnyao3xyIO9xkogckvZmKp85xTShssDG+btY4kY7 x+2M/uO7AUpAaL9LN9DlGQ8vqShZZOzTzVsC0rarrJlDzzqZJZFxRp3b38hJSEJ/ogxe KUE90tnLf6MArMLa2UVBbh4TR6lhgpnEyu7UlBHXdZ3WaSZv0Tut3Yc6AVphzdGHAMRV mJSmKCZQmar8LrCMxg60FzqVzCPL8LyqPuK02KSv9lU2DbpwZwDnLikxxaRlhk2F50zh RJww== 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=TSkNrS58bKuuMaQ3pbVX7LwrCeiMCVqBrL4d0IE+b8g=; b=PBYDXpDwCqRz7ZutaCrU2ZLbgYW1AN6KcRBe3uNLlqv+Dkt9+R/zj1SBfWoEaZWYaR 1+9EQ8Y3OF0wEYmSpYS5SCCE10wA4fmV63Sch6mOb7ZaHqeotIM0i+60uRSkvJcbU8S2 euVZcgm4uI4xVvtcPIbmHXiqsOXYiq+3H6vic5AlLrQBZRvYHzomRxbQl2xGfCCXt08T AZtfItn07wPY8Jw0wAy8WLtrtnnG1Yh/gSoUL0RRqK1bmwmokGIDMD4Upea9Gu0A1mEf 9M4Wm36CYEA/m+acdkSypnzcpGwHncJpv3CLihXAzYwa1ytDKoYhwEqGY53bXa9W+9WZ 8zsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zI8am+hq; 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 l21si8667799eja.295.2021.05.31.09.51.48; Mon, 31 May 2021 09:52:11 -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=zI8am+hq; 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 S232475AbhEaQwY (ORCPT + 99 others); Mon, 31 May 2021 12:52:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:51412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234473AbhEaO74 (ORCPT ); Mon, 31 May 2021 10:59:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 152B1610A0; Mon, 31 May 2021 14:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469709; bh=oZCdYh0GaTNFh1JuReU6Saj09bvN5Xj5UfK1544qd3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zI8am+hqB0q/8S7jBXhZoRR5Rd5VP4YCNJ7wD/ZFZFfjPdcJtnyjzF5QANCk/hsWY RAD5kiDlCGbCQ+FFo3ZorIw8e8sIMqDh93dEo0FQpAPRxNAg3bVXpc5KeTUDBcgVRt r5ZShHLfGVLXODnIU8XSb8DONr2PlZvm2mUIFO0Y= 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.12 290/296] net: hns3: check the return of skb_checksum_help() Date: Mon, 31 May 2021 15:15:45 +0200 Message-Id: <20210531130713.457954250@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@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 @@ -840,8 +840,6 @@ static bool hns3_tunnel_csum_bug(struct l4.udp->dest == htons(4790)))) return false; - skb_checksum_help(skb); - return true; } @@ -919,8 +917,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); @@ -965,7 +962,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, @@ -990,8 +987,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;