From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFAC52EA732; Wed, 30 Sep 2026 18:45:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790793914; cv=none; b=jfknc/Gk/mfwOIXcaEFg9QjuU/DzI+qu2kHpnJkPGcGzXETdvwfBRP77Z/vtPwyj860EACcEFaRb90gOqXt9p9cMuAMiVzvntqs+XqSuMbdlVtbvQd7OPSoucA+2AGSyDBq+bWU4NO3dkU8iHYpgAk+qls8QFzgewphDW1tiRbE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790793914; c=relaxed/simple; bh=1BsJiGpd0h2mXkvrU1qsIiLKG5DY4Za6GkYwa+Vua9A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M7FYny7gMqZVJycFZ2iLWHUj1ErJbxlKHNXrZHDMp2srk39CGYMgqv/5CgFghRi66V4PPggGlICYBbrCRTslG0WY8HjAAkGkM6AQWrHmMrll5Lfr/ua4RZMtu1QQZf8bE8ewMk16/S8U96bHVM7zdJwmQTHiAs7SLrEgto3sMpE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ZUTHbM8v; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ZUTHbM8v" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2990F1F00899; Wed, 30 Sep 2026 18:45:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790793912; bh=2XmoQbdGLnBb7u0u+YVbGhqcVDcBjR/HXKYnSgmYwW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ZUTHbM8vMNxo+X9j7m5lt1DOnyvJ0NhynKDBXCInZsEf3G2Kk2pQ/TP034nodyZ+n +L6W3g1V/F6anGJOXlZHH9FayZXg9uiKjdanMXEEjwhx4XfrQ9de6L4Q5KsBtxCB08 dG2hzcq0PDXK0KSeoN2vgGxhacNsKEro8JbmJLBo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mika Westerberg , Sasha Levin Subject: [PATCH 6.6 0026/1193] thunderbolt: Set tb->root_switch to NULL when domain is stopped Date: Wed, 30 Sep 2026 17:11:50 +0200 Message-ID: <20260930152434.875037832@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152434.301151190@linuxfoundation.org> References: <20260930152434.301151190@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mika Westerberg [ Upstream commit e56249d8a68e712f3b60e1f3fdbb5b4fea146468 ] Similarly what we do with the firmware connection manager. This makes tb_xdp_handle_request() return error to the remote host. However, we need to make sure we keep the uuid alive so that we can reply until the whole domain is released. Signed-off-by: Mika Westerberg Signed-off-by: Sasha Levin --- drivers/thunderbolt/tb.c | 1 + drivers/thunderbolt/xdomain.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c index d3c9479080ffe..dc9b7aac45682 100644 --- a/drivers/thunderbolt/tb.c +++ b/drivers/thunderbolt/tb.c @@ -2646,6 +2646,7 @@ static void tb_stop(struct tb *tb) tb_tunnel_free(tunnel); } tb_switch_remove(tb->root_switch); + tb->root_switch = NULL; tcm->hotplug_active = false; /* signal tb_handle_hotplug to quit */ } diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c index 834fb56bde026..867eac780cce9 100644 --- a/drivers/thunderbolt/xdomain.c +++ b/drivers/thunderbolt/xdomain.c @@ -754,7 +754,7 @@ static void tb_xdp_handle_request(struct work_struct *work) mutex_lock(&tb->lock); if (tb->root_switch) - uuid = tb->root_switch->uuid; + uuid = kmemdup(tb->root_switch->uuid, sizeof(*uuid), GFP_KERNEL); else uuid = NULL; mutex_unlock(&tb->lock); @@ -868,6 +868,7 @@ static void tb_xdp_handle_request(struct work_struct *work) } out: + kfree(uuid); kfree(xw->pkg); kfree(xw); @@ -2272,6 +2273,9 @@ static struct tb_xdomain *switch_find_xdomain(struct tb_switch *sw, { struct tb_port *port; + if (!sw) + return NULL; + tb_switch_for_each_port(sw, port) { struct tb_xdomain *xd; -- 2.53.0