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=1796380214; b=A82QCtV0Zjx1PZAH3c2FY6WuJWygIsgTbRamJ+stS7H6vKYjUcXt40ZLdL0qMVPH6rf1 5jsJAJ+M6FHCYhK0l8HRncYMxpVFRSJo5oBT5dD997bThZ1w3sTY3M9QNDpPrVDEP6VuB dmQI/ocuVCpF/557DxqCRtBQ/EhzDtLsDBrXXisgcTW/6b4tqgEuDWmOm1eOBZSBXGD7O cx635DvUaN3YPjoNRdmNitzOVAmrY87qAC1aigtamUQ90AEUWaKxLfuQezkitYKnuQvOd XCzHfGEXyvHmqnYidyCD97TACvB7tVlPmQ6/Z1+o4OMAesBIHfnrRi6xfjdzHxczGgQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380214; 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=5hWbHAIqlQNMmgb9sHF28AmKZ58CAcRSe0+Mvqk6l3Y=; b=OqP8jJhVF9r2aLIfeVOhwwbx57nL+MvWcVR0GPzmpxTW5IkQkMKrZkZP57k3OXK/ytm4 7EuGlA8LqY3j7QdYmOcoEV5qiob5VLvvFnndblubcI32GBcmrH9DFOoTOLxqt+nv7amrQ Ve9WNykj//gwBJGH5gotieZzy9HN3iLItTt+3UtBOciAYnut91Vzx4evds2fDEPE97PI+ GQ8SmxviUtXmhpFqkbUzZSFYwaJ/C+5KuTohslEmz/WSrR3SRVITNVDhDFY174abcCI6Y y2m7lzJRBIAv3lQQwSmwHT2guM9vRYSoBv5P/6qTCedqOSVWzzouRvE9PgTqQCaoJMw== 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=b46vxa09; 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 7A0F4606A330; Fri, 4 Dec 2026 10:30:14 +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=b46vxa09 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92B3B1F000C2; Fri, 4 Dec 2026 10:30:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380214; bh=5hWbHAIqlQNMmgb9sHF28AmKZ58CAcRSe0+Mvqk6l3Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=b46vxa09tHtrFF9Le3+huCKB2g7lBo17L0cVtJXiRKfqvpvAOmV6UqW9U9xJ5BTCf fhsTwqMLzS2t81UUA+yPX5+39w1AEOztxV0IxM3KwFweEudIVLL1i71/L7FbrrPQny dc51TK/qeTIME3Iu08e88gwyVYJXGqsuNEV4MTTw= 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 7.3 174/742] net/mlx5e: Release FIB event work flows before dropping RTNL Date: Fri, 4 Dec 2026 19:00:38 +0900 Message-ID: <20261204100639.713591847@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: 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 7.3-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 8b827201935eb..e6e2535e533a6 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