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 8A7DA3A7F4C; Fri, 4 Sep 2026 05:59:55 +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=1788501596; cv=none; b=MWDrVMTqHPL78UM0PAdDfOmBDoPoJszzwhNIOIyxTbgX6692I8iMolXb6z38XHO5CvZ/xykRX+J25u1njHG660N1Mmam37ZYuP9ohJgONXLH33e7ZXFE14U6shG/BLX4yrfMB3CpQ1F8cohEpNQCYVl0enVEqsc57Vgpt3N1CFw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788501596; c=relaxed/simple; bh=tep9xvOW7vbHMRiuHdupX6JOLw9+R+b+dVPs5QpIizk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Hr2qp9fxRtm9RaMg/O7Z5LAkQBNg/QUlf1nUgJw++mdS0tNRj9kEC8WkfMUwKf9d2SL0hKQ06oORmxz1G6egkrYLllW4OBXOBEyhc20fdAKQyEKO8vc+XQ33bAK7HkmENQcjrbw8w1Jaw8dZMUxpXGKFEfGL3ZKSkGs6padj4wM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BEybxnHT; 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="BEybxnHT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D462F1F00A3D; Fri, 4 Sep 2026 05:59:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788501595; bh=L8Ju/GWHT2VOqgpIiQoB6nvmotF0pJduFeZYvXflyJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BEybxnHTSjGCpWUvmrs+l5muX984k875PXnRH0PhUSgo/2HKf4JLsG9D8rb75oiq8 GJ3m1QZaB7E8mskYFBlHorAWk8rbcwBpsQvkaEZRRGEHDJPRrBZzupNGoFopX8dPou DojpGZ/S6sQboE4RUbo7/vl6drsK1SqTWSWn+wfY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Fan Ye , Mika Westerberg , Simon Horman , Jakub Kicinski Subject: [PATCH 6.18 465/552] net: thunderbolt: Mark the connection down when bringing it up fails Date: Fri, 4 Sep 2026 07:00:22 +0200 Message-ID: <20260904045801.238951153@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904045747.813364717@linuxfoundation.org> References: <20260904045747.813364717@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Fan Ye commit 3c8b26ebf525ba5960510f48c6e9936a79ebe76f upstream. Every failure path in tbnet_connected_work() undoes its own work and returns without clearing login_sent, so the connection still looks established. The next tbnet_tear_down() therefore takes its main branch and repeats a teardown that already happened: it stops rings that are already stopped, which is a dev_WARN() and fatal under panic_on_warn, and it releases net->remote_transmit_path even on the HopID mismatch path, where this connection never owned that id, silently freeing one that someone else is still using. Clear login_sent on those paths. That is enough for tbnet_tear_down() to leave the unwound state alone, and login_received has to stay set: it records that the peer has logged in and carries the transmit path it gave us, which nothing on this side can make the peer send again. Two things change beyond keeping the teardown out of the way: the logout request in that block is no longer sent, and the peer's next login request now re-queues our login work rather than connected_work, giving the connection a fresh login instead of a retry on stale state. Fixes: e69b6c02b4c3 ("net: Add support for networking over Thunderbolt cable") Cc: # 5.13+ Signed-off-by: Fan Ye Acked-by: Mika Westerberg Reviewed-by: Simon Horman Link: https://patch.msgid.link/20260811-b4-tbnet-hopid-v3-2-9e75d1b51331@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/thunderbolt/main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/drivers/net/thunderbolt/main.c +++ b/drivers/net/thunderbolt/main.c @@ -629,6 +629,14 @@ static int tbnet_alloc_tx_buffers(struct return 0; } +static void tbnet_connect_failed(struct tbnet *net) +{ + /* Leave login_received set: only the peer can make it true again. */ + mutex_lock(&net->connection_lock); + net->login_sent = false; + mutex_unlock(&net->connection_lock); +} + static void tbnet_connected_work(struct work_struct *work) { struct tbnet *net = container_of(work, typeof(*net), connected_work); @@ -652,6 +660,7 @@ static void tbnet_connected_work(struct netdev_err(net->dev, "failed to allocate Rx HopID\n"); if (ret >= 0) tb_xdomain_release_in_hopid(net->xd, ret); + tbnet_connect_failed(net); return; } @@ -696,6 +705,7 @@ err_stop_rings: tb_ring_stop(net->rx_ring.ring); tb_ring_stop(net->tx_ring.ring); tb_xdomain_release_in_hopid(net->xd, net->remote_transmit_path); + tbnet_connect_failed(net); } static void tbnet_login_work(struct work_struct *work)