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=1796381892; b=JcYmjvCnBDFFjASAYVyR2Za95XvaR48iQloOgDYX6psRgcTlsUw8TDY2c62QWaGbV8uq ab9k8op0EPQWcNzgjOTIve3XtAMH5EbpmJL7vcEE3sRk1s11b+JNmdaZx3jOQEtNpiNrt 1+B9Olfc/jsDf1/zQDXqj1ZhVn2ww9R8SbEFyNj/HQPgdvSLqYFYuEgL3aK1fCSOd70Qa 1s+b3SbDrLmOKk4lIh980PQjcI9g+IBaiOMb09nQ1NLsQL0wvT082PXpxbok0o0TEJj4d LktuZLE+ejyF9RqRbOO9P01y53gk32Oq3FFUXu6Tik3vWVZGbK9k5io6ShYnjOXMpeA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381892; 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=5exxS7uDoNecedRL6yVWkbze5J/+EBnBhqbe+PfzCLY=; b=oy+sXGFywJ2Wvboe0hGWfmnkw5Fr4P/oCAWE1bGKuchOLqLwMGBrxErHt0sMfD+G0eWy e82wEKTcyXJhKzNBFNSkbsREs2WNs9COKzRXZs67DgMqyEH/BiTwuELmTNzvTF5xYassz e31/IuRSvXUG2gjxoSrhkH8uH1xD1tRfhylSrsR81eGHJt2THgh52OhC1qI3abGW3vb0c C6lV096Lwum1NZyBKj1g790+kfNV745Uc4TdaSgGg0y2dQXqHMCboj3Rej2NAWrwtJwNn d8+s1GUrxtTUXdRoYh0zQqcPpNrBy+33yOsecfZRdpXu1Y3hmWYNnKERAyMG+tOnj7w== 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="bdvOe/Fe"; 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 B4566606A322; Fri, 4 Dec 2026 10:58:12 +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=bdvOe/Fe Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CF821F000C2; Fri, 4 Dec 2026 10:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381892; bh=5exxS7uDoNecedRL6yVWkbze5J/+EBnBhqbe+PfzCLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bdvOe/Fe8YoD49/izhmMdBh0hHRyinNkZAeoVqwU25/QThIk1Oo82Np8w+JniAtQb tFQm8txi4H9xnTNTqaPZnkFwfSwFCJDktYl7bCLM33nVW7SntuO1s961WUtEa9UwNc KQIaYkTJH39meu8UHGWEiRiWmlTZcK+ShUnZSwI8= 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.18 218/703] net/mlx5e: Release FIB event work flows before dropping RTNL Date: Fri, 4 Dec 2026 19:01:57 +0900 Message-ID: <20261204100633.632340935@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@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.18-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 0735d10f2baca..9f6eacdecffde 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 @@ -1721,9 +1721,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