Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2655569pxa; Mon, 17 Aug 2020 15:39:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0SC19ujBJeDcW8QiN7o33EN7lNV1we6XhTvVPGDjfivdHn4ppWPBkJyNIKJjQS3UspfC1 X-Received: by 2002:a50:f411:: with SMTP id r17mr16887791edm.190.1597703996749; Mon, 17 Aug 2020 15:39:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597703996; cv=none; d=google.com; s=arc-20160816; b=0/RtRgWoQpcCt6In+5G7lKPO/ils7w/A+T3Kw3mgHwmf9NSCsRvOAVRprxrrmNE7J2 E6w4nTUO0DSCPjMYhRgN5T0IRuGReQOOnVTMOQ/1DGqyulO/ZOAPuDtycE8RZoZEThgs JMBCfwzqgmggGJ7xzJ9OPvi/e+QqX9Bp0AYPjBWgWiiYdfwuFbhf421CXwGuolTvqV5H 7LQMnCOZqXs0N+drlUht+MDWT9PZV9N2zqKd0ELSWRJ56rwaXmmzgD/BPkNJjdPgzf8O jNIenh2OU9CnY5XaLe/bgORZmAxFMS2XLg0neDk459SYskvqjn5uK7GLktfRgEU7x3gG mCHQ== 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=d4E7Xu4WKOJAXTtv4i2brafVpdXfigglmblgYxwc998=; b=gzbHQ97H7mypGndzJTPZFnwjFwpm5Tt6h93vX+e6mZPHaYNVxbYfDSsPv7SRPusgOR xZYhWBpgiQXMi6B5WjLoHwLrpqq+tyakeoWr4U5IFenttz2aJMe5JTwOf22d1a6IBPH8 4Lteg8JtEyG508M8v22bjs+ECJZ7NVNVBU0kSl/5m5s61yqJVLXriARFQCOd89U6CSA6 WFcJUraF6vvlqDHwLSS6LOBiVC4ZVuNcc+xttzT0xE/ue1UmqtMdrFIHpjn056gRpHJE rKuFUXjGpMrR+uf6MW/Zaw8Ws57wpx9s9/jwd9DXu1fgPzG/YxFp0ev1y/xdelGOxIUb 5BHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YlrhGHLk; 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=fail (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 t22si11914920ejy.466.2020.08.17.15.39.33; Mon, 17 Aug 2020 15:39:56 -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=@kernel.org header.s=default header.b=YlrhGHLk; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390064AbgHQSKD (ORCPT + 99 others); Mon, 17 Aug 2020 14:10:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:56416 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388426AbgHQQHw (ORCPT ); Mon, 17 Aug 2020 12:07:52 -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 36D1320658; Mon, 17 Aug 2020 16:07:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680470; bh=DbhteEiKX5tPboPVUEYxtkdGCR+nSetH5b4ksEH+Ig4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YlrhGHLkTSl5Eu+fpj22hvsVpbMyjy7DrMYNZJBpgv0aHoBoxB8+XpyZVuuRCfiYP B9ak4mKK2lsuqC87c5ni42/7ieMSX0Y/sYLCHq28TJoCyrJOjAyN4+5XcPKvAYipkB vuz+kgFGFiXScK3RIE571x12GePR9JpZs4hKNfj8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Surabhi Boob , Andrew Bowers , Tony Nguyen , Sasha Levin Subject: [PATCH 5.4 192/270] ice: Graceful error handling in HW table calloc failure Date: Mon, 17 Aug 2020 17:16:33 +0200 Message-Id: <20200817143805.355574548@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143755.807583758@linuxfoundation.org> References: <20200817143755.807583758@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 From: Surabhi Boob [ Upstream commit bcc46cb8a077c6189b44f1555b8659837f748eb2 ] In the ice_init_hw_tbls, if the devm_kcalloc for es->written fails, catch that error and bail out gracefully, instead of continuing with a NULL pointer. Fixes: 32d63fa1e9f3 ("ice: Initialize DDP package structures") Signed-off-by: Surabhi Boob Tested-by: Andrew Bowers Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_flex_pipe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c index cbd53b586c36f..6cfe8eb7f47dc 100644 --- a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c +++ b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c @@ -1535,10 +1535,12 @@ enum ice_status ice_init_hw_tbls(struct ice_hw *hw) es->ref_count = devm_kcalloc(ice_hw_to_dev(hw), es->count, sizeof(*es->ref_count), GFP_KERNEL); + if (!es->ref_count) + goto err; es->written = devm_kcalloc(ice_hw_to_dev(hw), es->count, sizeof(*es->written), GFP_KERNEL); - if (!es->ref_count) + if (!es->written) goto err; } return 0; -- 2.25.1