Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2674964pxb; Mon, 11 Jan 2021 16:51:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJxtfaWH3Eo6f+DIs9DyyWqiGZRUSNL+BdHHIP86vKK+j4LuevoVH/Ix5Td4HtKs5ddQYYKn X-Received: by 2002:a17:906:b217:: with SMTP id p23mr1356609ejz.461.1610412710389; Mon, 11 Jan 2021 16:51:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610412710; cv=none; d=google.com; s=arc-20160816; b=lUdN3/rOsMo9d/Z4N+axdGq8qChrVPNL4IY6swwYJ+flm196zDnB6hKysdCzQe4LY9 8sfc+HAhvYzJH3lY7sevWbwd+KvfAeemEWy7aglpXSyw0o6w5ZIpTytbFaZmiX1FQvQA l2VGRdSsMtBfEGyksmgtFepdu+0KUULUeRh3OWaoJmc6wAp9KP3ll7oXPsg1dsn2SSGL BDd8N07RSm2dVCOWYFeSwByBcd+Gnn+686YhnAdVBSyTv9lD5kkjRtsgNd57tPRXD2rq IL8AS12mJh2ur4dGHJUtAItV0Drfqz5seOiXd38EjCEazQvf2D84/YYVJz2w9DI9No3W F1Vg== 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=XBtDjn95OBjk/ZiYA9ERMK9Nbjd9mmvcfTtO/zPDaz8=; b=IlqCoblCWKFbjGz0qsUKYqf5VNbbRRmpfr8JNEmHGpC1U+ZI6WbXYqm7yUu0y/4jE6 u1EmD7BRHXo1fdRSRJQ8whLUyNpH5LpShw09V9ixx0lsipf2QeEYKwlg65TuKO01Qm3E cvRqr9WwBqH7pdTx5XyNAfuVhTSDJiu0NETbxwwPRdhpL/0oJau7Hk/49J3DEOHECOk9 bnOYK1RZQwtT3q0gJUFlw2V7BhNhQUIdRVkah065xPHpNRf21X0C4RWo6QYKgf1eW388 o44EAHPvZM1jbiWElit/A45sWqzjS89QhOc7zg6VKaQVmzOhi2n45g0TH5FakAQ640mX piHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SKytvzCi; 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 oy13si419488ejb.397.2021.01.11.16.51.25; Mon, 11 Jan 2021 16:51:50 -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=SKytvzCi; 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 S1730470AbhAKNGh (ORCPT + 99 others); Mon, 11 Jan 2021 08:06:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:52960 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730332AbhAKNFi (ORCPT ); Mon, 11 Jan 2021 08:05:38 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3BD3422515; Mon, 11 Jan 2021 13:04:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370297; bh=aOY07mU5jEGpV+urwEDRc54pLz1BBurTgi7GjYUtSbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SKytvzCi/1UmxAxMeZwUsioZX7OAnQ3NuEHjmFSKB9EryJZH9VDtCuf9OHdvBZFq8 UCCV+bDgGffSumfEa35w1xtUFEp1fyj5z8eh0MHVOtVz+8WmqflA71Pm44klco7KDC P20ra2Jmmcka17w2hcHpkfvqpCTpYsKzkU+j3v54= 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.14 18/57] net: hns: fix return value check in __lb_other_process() Date: Mon, 11 Jan 2021 14:01:37 +0100 Message-Id: <20210111130034.606312678@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130033.715773309@linuxfoundation.org> References: <20210111130033.715773309@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 @@ -418,6 +418,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;