From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796380331; b=K6M0/3BuT7TbLQNgs9Lkct8Cw2JpwLj3RKxvvoRduqijykiDsA5Yg3kriIEFDUclpWIu VsQVuuN/Fafpzq9UWtN2gQtEvdraE/cteyn8DSBfO4Yrr6NCD+ya907jo87HXj23d9jvk mnm430zycFiV5HEkSC5VgUbUfOH1DP+iiypZJgFt8VoJt3EEnmNMortTrLPezlj0oBM/R BAsU3WpJs4Ph7wMVJPkOZyqHKscdI9NR0PE3iQ4EuHQxAh1g/vMjXvmLTvBDQvG+iT5JY IPDZuNTrNKWpge7UGjLv+3tcFqka5ZdCK7sWgjifrstcluUquJzlQsp9KUB9FWD0hsA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380331; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=e6xUuvxakIqcIIc2NEJ4lzIQvFjgsXk1P6mVFP6snAU=; b=ZY32NbLeSP67oNmLxxZeu0zuK7ldtovu0RhQP9elFT/L2Bbt3knzF1L0PFpCor+qaml/ 5stv3avlW5KVimglqWhQN9B7F5pueheDcbZ4OglUlnSL+Fpa49tyiPinp6tkAx8JBtHgb 52i5j/XWeOSHskJ8wgozD/U1CiB79gaF0LS4jrqB7mYeerb6neOJDrcmHXBCAJyqrvAv/ b5dy1GZ4R6Lw4eXuQr9f84G9NAtTmNA2oBntfAtQDm3d5oi5GP5ThQRNmllnfWv/izvLQ 3ma4ceZyICPfJXxF2YV6h8pZuUG/fKYtFyFxN8sG1BrNmDfksVnJezVSqlD1O/1ZjDw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=gf0X22wn; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1E70606A338; Fri, 4 Dec 2026 10:32:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=gf0X22wn Received: by smtp.kernel.org (Postfix) with ESMTPSA id 630C91F00933; Fri, 4 Dec 2026 10:32:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380330; bh=e6xUuvxakIqcIIc2NEJ4lzIQvFjgsXk1P6mVFP6snAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gf0X22wnTJQJlAWK75OVzpyhjlO8EUko7QCA8XTGgXMN7oNIqAT+AT0RWQCJC0/fi pAT6ljotb6jyREYctoLWHsOCXaBrPCV6OH+5Mkl+FeR2j712JoYuGPWTf62r6lz2Ip C1js/2b79w+Kw9+8QpgtPfheV7L28fu3zcpkxGvw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yevgeny Kliteynik , Alex Vesker , Erez Shitrit , Tariq Toukan , Jakub Kicinski , Sasha Levin Subject: [PATCH 7.3 176/742] net/mlx5: HWS, Handle NULL in vport destination action creation Date: Fri, 4 Dec 2026 19:00:40 +0900 Message-ID: <20261204100639.764309801@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yevgeny Kliteynik [ Upstream commit c0ec15a586556c11583d8e336c3963c231c379c3 ] mlx5hws_action_create_dest_vport() can return NULL. If this happens, xa_insert() will insert a NULL entry into the xarray. The next mlx5hws_action_create_dest_vport() failure will try to insert NULL again, but xa_insert() will return -EBUSY, because we already have NULL entry. In such case the code will go into error flow of action creation, and eventually will cause NULL dereference at hws_action_destroy_hws(). The issue was discovered by code inspection. Fixes: 8e2e08a6d1e0 ("net/mlx5: fs, add support for dest vport HWS action") Signed-off-by: Yevgeny Kliteynik Signed-off-by: Alex Vesker Reviewed-by: Erez Shitrit Signed-off-by: Tariq Toukan Link: https://patch.msgid.link/20261118173227.1957670-2-tariqt@nvidia.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c index 4b29d7183c4ad..ee3a6e011cad7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c @@ -441,6 +441,8 @@ mlx5_fs_get_dest_action_vport(struct mlx5_fs_hws_context *fs_ctx, dest = mlx5hws_action_create_dest_vport(ctx, vport_num, vhca_id_valid, dest_attr->vport.vhca_id, flags); + if (!dest) + return NULL; err = xa_insert(dests_xa, idx, dest, GFP_KERNEL); if (err) { -- 2.53.0