Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3881814pxb; Tue, 17 Nov 2020 06:07:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJxC3fX92dHsZsTldgc6xkJkMAM/nMShAfIsC6htxflUeuP1QPlxaoUHhEpu0UTUhDjyIfKH X-Received: by 2002:aa7:df81:: with SMTP id b1mr20336576edy.365.1605622053874; Tue, 17 Nov 2020 06:07:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605622053; cv=none; d=google.com; s=arc-20160816; b=Vz6SpL17/M9dwVEyP1mUNNpX9Yo4MDYvz2essNwXsoh3Hwlbkwo020Mv9MoTs0b/nk nuPRweBssDAvmODqeH/fWkCceJKeJEbTH6MFT/3iIDLh3Q5pKBxkqKgyFfAZDY+zVXlJ XLAP4xNAWcPx50Dp2trfmIJOMuC/iJhSulgVN66c8bqOwnvbKqBJ+wSfTflcs40bcjR1 Y03I1UVwnHvk3JPNmOqqJ1ZzIhN67CZkzezz1nW75lcJg9e7idd5ZbmB05Q+xcpQw4NQ oB/quP45sbnTJAiS0rsgrRNuo9H0SIuyBFF4GARjQ463N6/b/CCwaakla6pR/TiD9D1a Ep1A== 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=o2ih2IDVaCQm3clGrMFY2Z8JsZOpAxDG13YFAoMgBHM=; b=wbMu4wZ7800mdkNeWHFVbKskFmsSznvQlA5asTUofiJAGZlwkAyISTtvYvX8p4qS/X +5+n/nnact4sRzM6DNroJDKxb2BLVM5wIhypgUfnCAPty++g1+cJAe7ngtAmEBNKmfoi t59zUUh28CqsEMhlFdl7mVgABPdpxEmg8MuWYWEbN+xEuulM/YqZ9rHpE/yfQ9f0i8jc VOin4lN/VsXLz1QjSxLrmButTdPZRvwwySk7StHJFliPJNbu3tBJyZwPjGzMFVitAM/Z u6yr8wdCFaJcNZF7yVQiFWCmv9mQaplPeR7yRkz0lNKtOLpBzD4XhlPwjvax50cUkWuP LMvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LnCcB6Wc; 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 g22si13989432edr.89.2020.11.17.06.07.09; Tue, 17 Nov 2020 06:07:33 -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=@kernel.org header.s=default header.b=LnCcB6Wc; 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 S1728556AbgKQNJ5 (ORCPT + 99 others); Tue, 17 Nov 2020 08:09:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:38966 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728820AbgKQNJs (ORCPT ); Tue, 17 Nov 2020 08:09:48 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 3DE4B2225B; Tue, 17 Nov 2020 13:09:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605618587; bh=G3VA7LTo9ESa06POafIDvzCdeisOEfi+LO/KW2BkJ8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LnCcB6WcIBULLFgkK28uqIWIXSPlFwp2luMjG0manMREpm5PAqoU26ZsDuf0z6KQm Rx0VzAIf9ImRXD7dcDKTWY0bi9QY26YmuuN4gBjH2Qss0lH31ZjxkW2oBgqti601gp tz7wbhUY71OnL8wIlHMzRAoNDtnHotMjaDXhcUk8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Andrew Bowers , Jeff Kirsher , Ben Hutchings , Sasha Levin Subject: [PATCH 4.9 19/78] i40e: Fix a potential NULL pointer dereference Date: Tue, 17 Nov 2020 14:04:45 +0100 Message-Id: <20201117122110.044610112@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122109.116890262@linuxfoundation.org> References: <20201117122109.116890262@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: Christophe JAILLET commit 54902349ee95045b67e2f0c39b75f5418540064b upstream. If 'kzalloc()' fails, a NULL pointer will be dereferenced. Return an error code (-ENOMEM) instead. Signed-off-by: Christophe JAILLET Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Ben Hutchings Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c index 7484ad3c955db..0f54269ffc463 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -422,6 +422,9 @@ static int i40e_config_iwarp_qvlist(struct i40e_vf *vf, (sizeof(struct i40e_virtchnl_iwarp_qv_info) * (qvlist_info->num_vectors - 1)); vf->qvlist_info = kzalloc(size, GFP_KERNEL); + if (!vf->qvlist_info) + return -ENOMEM; + vf->qvlist_info->num_vectors = qvlist_info->num_vectors; msix_vf = pf->hw.func_caps.num_msix_vectors_vf; -- 2.27.0