Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2289843pxb; Mon, 11 Jan 2021 06:10:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3mjFPF+oHGhpaom0NG7HjqDRqvr+LMDs6bKALEhFT1vLujBc4OCNxMsaYAwt8ZodkicU5 X-Received: by 2002:aa7:d459:: with SMTP id q25mr14168823edr.279.1610374211768; Mon, 11 Jan 2021 06:10:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610374211; cv=none; d=google.com; s=arc-20160816; b=xDZkH+hXcpQHFTImp7yLXSp5ue37aDDAiV7lxCn2Ttm/QVmhYmEAW9dPtY8LdeJ4iW d3a+pY6ZqngoUEYHZgWQIsPiIbSV4UKPCorxdDaD4C0OkJNe9/tQa6w9RlGfPqsl8pV+ aalxBJBhf8nwheVEYvjWlR8kTwEerNrFpLW5RnFZWUxFGgL8Dv8PQHB/kAj34g+2GNjq DszVdp9W5kw+xszojGvNltwxBQ6B+D46tuxP/KIqu8yhECSW4yGeqV0IRv3Gwin+GVru 9P0Kom/gLVU5NrTlkHz4ZRqJkmO1S+OggIwf/sPk2XSKKm2AkKARrOCE7wWRW4s0i+a/ g7dw== 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=2GrCLv4Jhr7Ei/hhQMZf0bopF0NK350BcIiPK7dFM7k=; b=gqGP5jpC0ZeNZoyr6ErfVNRO0eeM7wMaAwQ6yLcXasgbQoXExAVfejHxtgOIGlC/Wx BfwpA9bSkUmE5ebR6YZ8OmCyg2AZPn/06zPpi8wvRJwxOk8K5FtFxCW/o97eWPNFzz2D ADxPt/5ln4OxztV8rBYFtDqCSCYxJ+lrUCBU3WvmI4uWwO2Xb1wZV3aNATpUz2nfNU3k MFudcpHRztHTPip5gNDDGzZliJHbOgB8GDx1gw12G108JiV7Nhz56I5HnMJNGL2qkF8J TzKnoz9tMzlRc7c8YmF6zkIKtkOMVFLWXhpHv1iVv1vK9+WM4kcQWeTz8UNoIcXPR7pK ZH/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d37bZTfA; 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 b21si3008837ejv.550.2021.01.11.06.09.43; Mon, 11 Jan 2021 06:10:11 -0800 (PST) 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=d37bZTfA; 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 S2388418AbhAKOGj (ORCPT + 99 others); Mon, 11 Jan 2021 09:06:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:50822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728055AbhAKNDy (ORCPT ); Mon, 11 Jan 2021 08:03:54 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id ACEC422ADF; Mon, 11 Jan 2021 13:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370176; bh=CpjiHtyJeATbfgkR8IbujFim1oHq4xj2LJmCjeroXW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d37bZTfA57oWnIQAyG0DW6KI/8BVLvEKScQ0pN9WyjuA4x0Hc+Pn+Dm5PLNUD5wey NYfQTXrsFRU4a9oDRr3PpDnLNYKPFq+NjrFUfPLwIz3hGKm0k2gf9qNC1dy2xvQaw0 u8apqsozJ/9+qW269ni0naWm9DhgHFmioKDy0N/Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunjian Wang , "David S. Miller" Subject: [PATCH 4.9 11/45] net: hns: fix return value check in __lb_other_process() Date: Mon, 11 Jan 2021 14:00:49 +0100 Message-Id: <20210111130034.207604013@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130033.676306636@linuxfoundation.org> References: <20210111130033.676306636@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: Yunjian Wang [ Upstream commit 5ede3ada3da7f050519112b81badc058190b9f9f ] The function skb_copy() could return NULL, the return value need to be checked. Fixes: b5996f11ea54 ("net: add Hisilicon Network Subsystem basic ethernet support") Signed-off-by: Yunjian Wang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c @@ -447,6 +447,10 @@ static void __lb_other_process(struct hn /* for mutl buffer*/ new_skb = skb_copy(skb, GFP_ATOMIC); dev_kfree_skb_any(skb); + if (!new_skb) { + netdev_err(ndev, "skb alloc failed\n"); + return; + } skb = new_skb; check_ok = 0;