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 61A361C6FEE; Wed, 19 Mar 2025 14:34:06 +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=1742394846; cv=none; b=ioyM0USzCqPDVL91HH44/ioe73ncZRcl//Xvl/qkgCSQnT3Mr//uLRTlfTyjEj75HBK1on0nZDkYz+9GO5Q0EVJTY6f4Ny51UNtH6qCkXsBZbINH6oUlGLva/pFf8mTP3p9ttNFSxofNW2QXxQ1npvLMeS9qshMH1A9SLoGFLBA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742394846; c=relaxed/simple; bh=FD9PGEK8Z3zvVjIh2KTM/m4hQfv3j7c7zFcmD3YHqXw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UURJ8J2tLCWvrUUfZje8/bsEVwu8Lsimi9KP4iO0aDO0uDFgQ+BdPGfszj49FcwgnvOXQL6/pA12KQBodKejiFjmINU+rVxo0G+IAkxBZe6cmeVQ/7M/ZpMdGSsvHCcPjsc4p8WKhl8fB6uyULpl5Z4HkNlaia5H5J86/lngOmA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=npYbtpDF; 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="npYbtpDF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32E3FC4CEE8; Wed, 19 Mar 2025 14:34:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1742394846; bh=FD9PGEK8Z3zvVjIh2KTM/m4hQfv3j7c7zFcmD3YHqXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=npYbtpDFfza3oL4oFphTpHw1ypFwFSFCWKVRlSz2jujrBXDtBwN6FsOrFXPfJyO2Q yuc6XS/9PD0HIe2RqsdFMnK5w4ljEd9aiFlR57TUfkAnXZo+ZI3bIIfhjeU6pptExh 8u6h3fWUcWo1hcsyrZVv7eyUmPJP/UsAPnYh++8I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wentao Liang , Tariq Toukan , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.13 031/241] net/mlx5: handle errors in mlx5_chains_create_table() Date: Wed, 19 Mar 2025 07:28:21 -0700 Message-ID: <20250319143028.485559600@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250319143027.685727358@linuxfoundation.org> References: <20250319143027.685727358@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.13-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wentao Liang [ Upstream commit eab0396353be1c778eba1c0b5180176f04dd21ce ] In mlx5_chains_create_table(), the return value of mlx5_get_fdb_sub_ns() and mlx5_get_flow_namespace() must be checked to prevent NULL pointer dereferences. If either function fails, the function should log error message with mlx5_core_warn() and return error pointer. Fixes: 39ac237ce009 ("net/mlx5: E-Switch, Refactor chains and priorities") Signed-off-by: Wentao Liang Reviewed-by: Tariq Toukan Link: https://patch.msgid.link/20250307021820.2646-1-vulab@iscas.ac.cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c index a80ecb672f33d..711d14dea2485 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c @@ -196,6 +196,11 @@ mlx5_chains_create_table(struct mlx5_fs_chains *chains, ns = mlx5_get_flow_namespace(chains->dev, chains->ns); } + if (!ns) { + mlx5_core_warn(chains->dev, "Failed to get flow namespace\n"); + return ERR_PTR(-EOPNOTSUPP); + } + ft_attr.autogroup.num_reserved_entries = 2; ft_attr.autogroup.max_num_groups = chains->group_num; ft = mlx5_create_auto_grouped_flow_table(ns, &ft_attr); -- 2.39.5