Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2634845pxa; Mon, 17 Aug 2020 15:03:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyc1yGAWg6DWicO5lcUr+VfBes9OvZ2mLc6+AZcUmXxSsN+0m8VpK+Ipz50MB67iWQoY6hc X-Received: by 2002:a17:906:d9db:: with SMTP id qk27mr17081394ejb.37.1597701802535; Mon, 17 Aug 2020 15:03:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597701802; cv=none; d=google.com; s=arc-20160816; b=l2aqgM59Fhs3lPNwUAonb7sRaH57ucV83+MzBTyG8NWn9XkQI5aoFFbIys6iZB5Mt+ 9z+iiBxmI14jVKhP6g7aqAEd1wquJ8PEao/vzLYP8Usu+WGT7b6bC6m4Z52RlzxOyhfI hXVJadX6GVOqfZAO6tsYIiUOffg9SsaBnIcHIvHP2OyYvKA2jrQC3HSDhrQWIgJdreUM cSh+t7uUUCZdTbyRrxPlO88hVzV2BS3KhLCKlz3jJfUa1PN2Ia0Qc+MIcuxAya2oCzWa llPbZ7PdgnjtsT9qECe6nrLmquc7B00SUUbzoD8c7UsDidPfGvYW7DaEyNNG9pKiQ5Vo HGMg== 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=8uEQzErCRmB6O9IkIdxFsfellR/PSi/VLZgPuMyJIyQ=; b=zMliiBl/0Aqw34VAWhVklRF13w45jtDhdpmaDwJfd1DQI95UvjSzwqPnz5/7NKg2Vb 8ZrBmHcSSkQx+dKS5+poL5kxAT2XPqZBm6jj/4MdPBeCcqpNzuFjzB2beefloDy2kCQJ yKhfz0g3DiByh1fotuEewH2JnOuKaUCswnEWFKjh7Hn7Q4/BrDrEE1hCEDMnuSV+ucwj O8/B4IEfGG6U5qJUM41F+5g8YVD3BcHgbmy4kb/TZtqKzC7hXRWYP3v7KwSxpnOigkl7 qFiNUnqHDQCJqtPgP3v+PmPhKXhnSNff8rFZfScmIqJ9Ta/0NM939eupuFzPOGwVjM7g y8tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ehh5VuiM; 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 r10si14259797eda.261.2020.08.17.15.02.58; Mon, 17 Aug 2020 15:03:22 -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=Ehh5VuiM; 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 S1730776AbgHQPlw (ORCPT + 99 others); Mon, 17 Aug 2020 11:41:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:39474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730242AbgHQPe0 (ORCPT ); Mon, 17 Aug 2020 11:34:26 -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 33E46233FE; Mon, 17 Aug 2020 15:34:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597678465; bh=/u610J051YLC42YLmGhLdhRzg2RFOI1y6QVRsg1ftOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ehh5VuiMyup1E+GTy8H51sj3PGKYyqJPKavhl9PpKEN9PLLdY0YQ6AIkIUkiGz+9K wAGljlChiXLmvpTwe5SfVUv7+82rOaqp3O0z6iWNsnKwroWOs0EhzKjPPf7AV9gWe5 PfEIbItkGU/Sej7gaYw7roNZn3OV4WTT01Dh5TTg= 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.8 343/464] ice: Graceful error handling in HW table calloc failure Date: Mon, 17 Aug 2020 17:14:56 +0200 Message-Id: <20200817143850.201190433@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@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 6698612048625..504a02b071cee 100644 --- a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c +++ b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c @@ -3152,10 +3152,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