Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3421728pxf; Mon, 29 Mar 2021 01:35:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqoN3AZPaPJ+qNAJm9gwQbyhTRyhPml4qCHSpES5At5bO6SzXH1ceqgYnfRJ9csTQi/iLr X-Received: by 2002:a05:6402:10c6:: with SMTP id p6mr27236609edu.241.1617006920439; Mon, 29 Mar 2021 01:35:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617006920; cv=none; d=google.com; s=arc-20160816; b=dYdmI2AwZ0F+bXi143qunZzFNM/87m17QhR2zUnLeheom4Btv3ZfPi4a1R5ugG/rET 3mIs0G/UAFMdYan7W3XvAUPwksSDc4EEjd9uvQzv0tQDW0QizGYX9LxDvPqty7QERonZ QHadgBot8Nd9YtcQQrI5GokOp6d+ABP3MZbkrNM0yd/9C9kGf6+MOdVTCCbYF5mOvSKc VXR8UVcTwtXg/FAl5KafTmd00lXgUfSLjJ2KbX4MhEZqdwvIXckjyM8CUdyNghSUiavB SlbnvG5QDiBmgbkJUv3/JZhz5BL3OSIa1NbGnTGb4koC31w3KSUi8dsykoY1MOCTRHem asIg== 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=Fh15ELo2aMmx/0WHtcJn+tX3D5cmpv3BwHvRW6DpVLk=; b=0NU6OvZkUsnOuB9+p4PBBxjX6zxyo8ICF3J+blaTrc9U6pQdjCmmDORH1FrZ9/9lZ7 sw3IGRnK6v7whpRJPNmj4+vcfD8Z0/0i94wAPX9svck0XFCobTN2suEVj1eZJG9tvH8C iChl1ct6ssJpkhIPqP3NxvF9mwMaZ3pmB1YjwvkjoaawVAW3Yvs2H2Kk2/1ppm3oUAjy o80YKHJc9XkkPGA8f4yrDA5U+hu2w/6sMe4jXVJgUhacnVpHik8mgABsYqnfzLZrOfJk dyya1kV2/Ti9KZVDX/5ZvJ6XnSEmcR31enT1u+scl4s2XyRGfxxkogjckjC5THqTcggM xW8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oYQAlYjK; 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 bx8si12686394edb.517.2021.03.29.01.34.58; Mon, 29 Mar 2021 01:35:20 -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=oYQAlYjK; 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 S233062AbhC2Iaq (ORCPT + 99 others); Mon, 29 Mar 2021 04:30:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:36086 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232169AbhC2IT2 (ORCPT ); Mon, 29 Mar 2021 04:19:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1A5A461481; Mon, 29 Mar 2021 08:19:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617005967; bh=BSr895P/4B6mnzqN/TdgGbsmYiKqVrNY3F2oEovtnLE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oYQAlYjKNDwaeroCuza9NQsFzR+eBRCI/waVav8rJjbVK9QdKwZU/Ld2TyRGklDCE izC7qJ66qcCpRj7IQ2ddCAzYH34IJ/39alMUmJ9vUZxnNmZWvJLxJPl0RVC4f5BGi9 BiUGJ16MMGBRuQQtJsVNMlSyO9z2dVB+bVQBQ/PA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, TOTE Robot , Jia-Ju Bai , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 024/221] net: hisilicon: hns: fix error return code of hns_nic_clear_all_rx_fetch() Date: Mon, 29 Mar 2021 09:55:55 +0200 Message-Id: <20210329075629.989172305@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@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: Jia-Ju Bai [ Upstream commit 143c253f42bad20357e7e4432087aca747c43384 ] When hns_assemble_skb() returns NULL to skb, no error return code of hns_nic_clear_all_rx_fetch() is assigned. To fix this bug, ret is assigned with -ENOMEM in this case. Reported-by: TOTE Robot Signed-off-by: Jia-Ju Bai Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index 858cb293152a..8bce5f1510be 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c @@ -1663,8 +1663,10 @@ static int hns_nic_clear_all_rx_fetch(struct net_device *ndev) for (j = 0; j < fetch_num; j++) { /* alloc one skb and init */ skb = hns_assemble_skb(ndev); - if (!skb) + if (!skb) { + ret = -ENOMEM; goto out; + } rd = &tx_ring_data(priv, skb->queue_mapping); hns_nic_net_xmit_hw(ndev, skb, rd); -- 2.30.1