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=1796386338; b=o0C85L9fasz1RZed3SaHOf1agjbc7KRa1e33lPeXA93fE3TW5MEk4sitUkEfsbPehnlO MG7lwYLRkXL6kQZEIfCrFr4rK/UR7RcrO2E/Z++L3LslaDm2pRPbdWYotnkl4QHG98yAg AbI/VMeYo/rx7L6e9Sjyu6Au7LnbNf9jeAGNgtK7QvpmoaHUk/OGckJJLolab6/LrSzX0 Sz5KelBQyyhiyXqjGwhkdGCY6yu1CmjM4ZXNME0UYWBR5R86mklI4eXm/r03ip8gtvlcK wHXquiv/AalhlDHBEv8Z3H7042S8/pcdQKUKHmu/NgCDasRarlfJXDFN00QpOyttS5A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386338; 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=QcO7jifmdXKcArbqXgtS4S7JHj0yWX8mAs7WlMoXVJA=; b=TTCqS3z4Y6mCAwJ4/UC7yKN3jXNtMafZBcg0pcqFJBPpbiyJTa4xbUr4br032j2mUcex v0MZnzSxNuH97HCmhUpv6U88CNTwevUVtXxKf0RQDhMtdARdm506vNUZb7BaY4tK0F1mk /HlcT+1IyHuGQwMdFbLsN8CI3GUyEhSp/hPyugUSUaRvEn04bTVBYyrjI0qlH7AeR7p3Z 5ObqiE5Y7xcW2idDmE67TFd42/f97bceCrW9mfYFJIPo30rBLvxymFWGvMiZyGYcK0iEV w0ExCynp0Na9IvFbFk2xVvI4brYzblTDLxywWiflhSFk6hTrdCyGFY7k07jVdXKFOkg== 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=rEg+0hQe; 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 32E9C606A322; Fri, 4 Dec 2026 12:12:18 +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=rEg+0hQe Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A1301F000C2; Fri, 4 Dec 2026 12:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386338; bh=QcO7jifmdXKcArbqXgtS4S7JHj0yWX8mAs7WlMoXVJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rEg+0hQeK344VufDBPfgZi2X1GkRsiTANu+1slaCxX2oVdTe5pqKOrF+TlK5/e8o6 5785kMbIaVLp/S98GOc2wleqiAa2taW30a09hDPUtXmP3acM0iRPoLfjL8q6NYizI5 mRT0WlxJxZ6rDvNWaiOH1LWbq87Bs9k93972gtaA= 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.6 0921/1167] net/mlx5e: Release FIB event work flows before dropping RTNL Date: Fri, 4 Dec 2026 19:05:48 +0900 Message-ID: <20261204100726.187442265@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@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 6.6-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 c11092da2e7d8..0263837f410db 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