Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7369330yba; Thu, 2 May 2019 08:43:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1tSTtN2iuP47kOEC7hhb5SXXmGG6Ro6zkfoG/17htHRYE69qMvPHBAEWPuY+N48Ns8tuo X-Received: by 2002:a63:fa54:: with SMTP id g20mr4728581pgk.242.1556811793445; Thu, 02 May 2019 08:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556811793; cv=none; d=google.com; s=arc-20160816; b=R9NZWUj7qCy+lo06rKofozzVjtmIqyyAk2Iy+knyJ37FGMkDRZAOR5y8R90aiIN30P TVAEeF+JbZWHDm3aRGCvDDyWMxqj1V6WE8TH9+LtawSZBRpdnMaehvJyxq5GP1N9F83P WWDZUraF7kDbJ8mi+OEf6B708MfD7hDREZ82q9+dGtOQ0xcLVVaftQdn8ttuRiv5zWwt vXuNZR5mWpWgcFTughqmC23NdR7VGe7y8j76mwkyR2PhRm0VWcSxYoLD3/Me/0WyXbt2 0ru9xVZEf7mRAX9Rbly0haNsCeu1w7ia155m6dbInYNSiI/yiEKa8foZRxPrJC9rd+WI jqVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9tQkRFEdOHTdsy+kpIWivZ5clbDc6E72TZqjxuUp8mQ=; b=CNBGe9UfDR9AC44xmlZHU0Q1Zww6jilQeKonLUaIiaF2lUF3JK4IDR+MlVjD8mzFzN rGI2JAzeFVKVLv3oHsKi4nPEYgv7p+cuZuR8EbqHfVdfoz02XuQt5w5T7u/As8dLCeJc HTTsOdCD54wvb7ZS6QWw8RgPPs7Cc0Thq9HX95pjpV38TEMKPG1f6FCQgW/EYYPykg6o 3att+UcriC23BLc4P04zFsEJbw14eA4NDp8O3/cvO+yHM2H6bszugHAZALNqKizl4uLj Cm/+3CSCRXtY1rJvhsvKUqGn20mBQL27iQ1zs2iE89xhSWuz7ROM4VqgRaoH2/KgxNBn LLlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cPlMyIHg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y22si1892429pfe.141.2019.05.02.08.42.57; Thu, 02 May 2019 08:43:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cPlMyIHg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728410AbfEBPke (ORCPT + 99 others); Thu, 2 May 2019 11:40:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:46808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728327AbfEBP3L (ORCPT ); Thu, 2 May 2019 11:29:11 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2C2CD20B7C; Thu, 2 May 2019 15:29:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556810950; bh=WJN5iWIvcgKpaO/zBux1NJbNQ6G/V7nfw02+h+bfIvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cPlMyIHg41hrOk4Wm1x/veLKH1AN27Sstmf71yejy5r9fqdvyIZRkNzPJN0bdw3YU GX9tZqhPrygfM9fqrdBogqgFX1MrnI4asJCfKbVe4JW1WAM+EznIM+qQu6qY64Lqf4 EhRsCMaS/hNZ9YatLoObHVacjrzp7RlzVHaxvyew= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aditya Pakki , "David S. Miller" , "Sasha Levin (Microsoft)" Subject: [PATCH 5.0 019/101] qlcnic: Avoid potential NULL pointer dereference Date: Thu, 2 May 2019 17:20:21 +0200 Message-Id: <20190502143341.243272955@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190502143339.434882399@linuxfoundation.org> References: <20190502143339.434882399@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 5bf7295fe34a5251b1d241b9736af4697b590670 ] netdev_alloc_skb can fail and return a NULL pointer which is dereferenced without a check. The patch avoids such a scenario. Signed-off-by: Aditya Pakki Signed-off-by: David S. Miller Signed-off-by: Sasha Levin (Microsoft) --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 3b0adda7cc9c..a4cd6f2cfb86 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c @@ -1048,6 +1048,8 @@ int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode) for (i = 0; i < QLCNIC_NUM_ILB_PKT; i++) { skb = netdev_alloc_skb(adapter->netdev, QLCNIC_ILB_PKT_SIZE); + if (!skb) + break; qlcnic_create_loopback_buff(skb->data, adapter->mac_addr); skb_put(skb, QLCNIC_ILB_PKT_SIZE); adapter->ahw->diag_cnt = 0; -- 2.19.1