From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03F2C1AAE02; Mon, 14 Oct 2024 15:11:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918677; cv=none; b=hgpaNqS/T7Qsx6XvkEdDqit0a3NXc9Aww4JrS5ULMHiVTfZfuR9fQwxPngZckSAdaLgwgVqVTJTISl/fB5LfIWlne5hktKlLQkrsvxY7795c9aPUWQUBVqWtCd8TcuvmhYB7lHWRaEZVJn1rzsRGj8PCS0ZD6J++Drtm8QNcUvk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918677; c=relaxed/simple; bh=sa0QdiJKKisCfgBqT0+TnMchyL11MTbLFD7EsNzSMcY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NrBhYQIXqAM7Ls4yVC6aN+Myfn9pt9HxAb36rDs8bOTsx0alUTcYNnCpe9pud0gxYhOL87tBMxR+C2MpUkOam9ePigiTm0HDQJRw3r+05CMnyksCzu0/+IWbHsMKcanRkqw57TSGOJiFGR6FWnC4hbR/9t3p3txU/lHaRZrsbA8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tHsEMdBk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="tHsEMdBk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E796C4CEC7; Mon, 14 Oct 2024 15:11:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728918676; bh=sa0QdiJKKisCfgBqT0+TnMchyL11MTbLFD7EsNzSMcY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tHsEMdBkXKeU8Q7jM9gc6cc3pt8LLnK4PWjZz+geFQFiTBs7QTCcd0tUtvxuojVRQ aPISTrIYp9W+AJMa14zNuG0Aqe1BNClXvxlFSL9t/Nq10AqEdKPrqtBHWsyM6naOin isAYklDwnxIqonGqt6YVJ4SFHP39U1Vyo00j0K+s= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Elena Salomatkina , Simon Horman , Kalesh AP , Tariq Toukan , Gal Pressman , Saeed Mahameed , Sasha Levin Subject: [PATCH 6.1 389/798] net/mlx5e: Fix NULL deref in mlx5e_tir_builder_alloc() Date: Mon, 14 Oct 2024 16:15:43 +0200 Message-ID: <20241014141233.229333103@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241014141217.941104064@linuxfoundation.org> References: <20241014141217.941104064@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Elena Salomatkina [ Upstream commit f25389e779500cf4a59ef9804534237841bce536 ] In mlx5e_tir_builder_alloc() kvzalloc() may return NULL which is dereferenced on the next line in a reference to the modify field. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: a6696735d694 ("net/mlx5e: Convert TIR to a dedicated object") Signed-off-by: Elena Salomatkina Reviewed-by: Simon Horman Reviewed-by: Kalesh AP Reviewed-by: Tariq Toukan Reviewed-by: Gal Pressman Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/en/tir.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c index d4239e3b3c88e..11f724ad90dbf 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c @@ -23,6 +23,9 @@ struct mlx5e_tir_builder *mlx5e_tir_builder_alloc(bool modify) struct mlx5e_tir_builder *builder; builder = kvzalloc(sizeof(*builder), GFP_KERNEL); + if (!builder) + return NULL; + builder->modify = modify; return builder; -- 2.43.0