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=1796383464; b=2dZj1ewqA3hJSOihk/sICnM9vBE9oHLPoIBLZd55BKeS5D+QUKfR+W++XmUsoESP50em jDggdtY0y+6GGdZdepoVVPQZNYUgdCVu8jnvAezfAYO4E0rJG8rrQzENYlOadtPdlscIz Xfy9Ff3hysFhvRSjn8sFhBXwQRpR+b0e8+GjDN8jlmG8/zosPtBKGFWjZywRqBeKqJ5iO qjyh2RWrG42rEYFp4Z5tRQJRVpzByh6u4K5nzetKatwnHDPM5qy4deuQkTu1ro3rMH0EI RIcir5XZ0gpJgOWy53352OK27WkUg3vLIcZNsCtSbvExrtA+zcb0uyTH9QMZMw7LYRQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383464; 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=Z9t/u9d+sm5O4I3x9Y368gVtwEQN0yd8GoZ3zXy2JB0=; b=BlILKvfNXiAKy8GMDwYYcOp8ObXfiWylbH0pOBku5v2DyWE17h8yyNlyGMr+8jI95AlI jS/67htANFd/tRYpp03N1FZJtrgF/ZnxG76co5cRza71NLHP6/yNI5p+UU3qn/WFRDt+j CPkjBrnjAQlWi4G6XOhWVfXZbhG10ZSHbo7vucHb8lQLVr2AhF4Gvec704jlxhKiWJT54 Dp4B9JR9ZEyHxjFrYw8gdg3lzGMDc6iVvNlaz1MMqszTOVOHL1dEQQte9cDavqsoQitO0 5jkrcRT/2L8jsPQMBLzJbpXuoJAFJKPUvqdGc7dWU1MMWE+UHmVemQVOqt2oeOTniPg== 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=WgYqPPC9; 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 3CB67606A6B0; Fri, 4 Dec 2026 11:24:23 +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=WgYqPPC9 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 603341F0093B; Fri, 4 Dec 2026 11:24:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383463; bh=Z9t/u9d+sm5O4I3x9Y368gVtwEQN0yd8GoZ3zXy2JB0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WgYqPPC9/NjXsM4zLeA9HivQ/Cl941fIT8gMhJ+5zYGu5BQx4vfNtgEn8a2mDMsX4 RLYXDMFHCHQLIFdznqEj09XlYDJu3B8fslgdpydlRkltj91WV5nUs0Gf03Z5xMYNC+ I4+D3WrLc8i5wacTSXY8cR8rwckzrXYqsMWngE2Q= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Gal Pressman , Jianbo Liu , Tariq Toukan , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 228/555] net/mlx5e: Release FIB event work flows before dropping RTNL Date: Fri, 4 Dec 2026 19:04:31 +0900 Message-ID: <20261204100617.809610707@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Gal Pressman [ Upstream commit bfccb4e44e4725270ccef366078d7b6063920ff3 ] The FIB event work, neigh update work and the neigh stats work all use flow->tmp_list to hold the encap flows they work on, while RTNL is what keeps them from using it at the same time. mlx5e_tc_fib_event_work() drops RTNL before it is done with its list. A neigh work can then take the same flows while the FIB work is still walking them, and the two overwrite each other's list. Release the flow list before dropping RTNL. The issue was hit once in our regression testing (OVS connection tracking with the VXLAN endpoint on a VF, KASAN build): BUG: KASAN: stack-out-of-bounds in mlx5e_flow_put+0x23/0x80 [mlx5_core] Write of size 4 at addr ffff8881226d7b20 by task kworker/u40:1/20171 Workqueue: mlx5e mlx5e_tc_fib_event_work [mlx5_core] Call Trace: mlx5e_flow_put+0x23/0x80 [mlx5_core] mlx5e_put_flow_list+0x82/0xe0 [mlx5_core] mlx5e_tc_fib_event_work+0x704/0x1fb0 [mlx5_core] process_one_work+0x8df/0x1660 The race was also reproduced with an msleep() inserted between rtnl_unlock() and mlx5e_put_flow_list() to widen the window, a VXLAN encap rule whose endpoint IP is on a VF, and route churn on the endpoint address. Fixes: 8914add2c9e5 ("net/mlx5e: Handle FIB events to update tunnel endpoint device") Signed-off-by: Gal Pressman Reviewed-by: Jianbo Liu Signed-off-by: Tariq Toukan Link: https://patch.msgid.link/20261118143653.1915247-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c index e7e01f3298efb..1f87fc5bb56c0 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c @@ -1724,9 +1724,9 @@ static void mlx5e_tc_fib_event_work(struct work_struct *work) r->flags |= MLX5E_ROUTE_ENTRY_VALID; out: mutex_unlock(&esw->offloads.encap_tbl_lock); + mlx5e_put_flow_list(priv, &flow_list); rtnl_unlock(); - mlx5e_put_flow_list(priv, &flow_list); mlx5e_route_put(priv, event_data->r); dev_put(event_data->ul_dev); kfree(event_data); -- 2.53.0