mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] thunderbolt: stream: Undo more if the start fails
@ 2026-10-27 14:24 Greg Kroah-Hartman
  2026-10-27 14:33 ` Mika Westerberg
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2026-10-27 14:24 UTC (permalink / raw)
  To: linux-usb
  Cc: linux-kernel, Josef Bacik, stable, Andreas Noever,
	Mika Westerberg, Yehezkel Bernat, Alan Borzeszkowski,
	Greg Kroah-Hartman

From: Josef Bacik <josef@toxicpanda.com>

If the receive buffers cannot be allocated or mapped,
tbstream_dev_start() stops and frees the rings, but

 - leaves the DMA paths through the XDomain connection enabled, with the
   hop IDs of rings which no longer exist;
 - does not release the frame array and the pages which
   tbstream_dev_alloc_rx_buffers() had allocated and mapped before it
   failed.

Fixes: 6db21d817b43 ("thunderbolt: Add support for USB4STREAM")
Cc: stable <stable@kernel.org>
Cc: Andreas Noever <andreas.noever@gmail.com>
Cc: Mika Westerberg <westeri@kernel.org>
Cc: Yehezkel Bernat <YehezkelShB@gmail.com>
Cc: Alan Borzeszkowski <alan.borzeszkowski@linux.intel.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/thunderbolt/stream.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/thunderbolt/stream.c b/drivers/thunderbolt/stream.c
index 4f9a57b77bfa..c9e1987a6924 100644
--- a/drivers/thunderbolt/stream.c
+++ b/drivers/thunderbolt/stream.c
@@ -683,6 +683,12 @@ static int tbstream_dev_start(struct tbstream_dev *sdev)
 err_stop:
 	tb_ring_stop(sdev->rx_ring.ring);
 	tb_ring_stop(sdev->tx_ring.ring);
+	tb_xdomain_disable_paths(xd, sdev->out_hopid,
+				 sdev->tx_ring.ring->hop,
+				 sdev->in_hopid,
+				 sdev->rx_ring.ring->hop);
+	if (sdev->rx_ring.frames)
+		tbstream_ring_free(&sdev->rx_ring);
 err_free_rx:
 	tb_ring_free(sdev->rx_ring.ring);
 err_free_tx_buffers:
-- 
2.56.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-27 14:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-27 14:24 [PATCH] thunderbolt: stream: Undo more if the start fails Greg Kroah-Hartman
2026-10-27 14:33 ` Mika Westerberg
2026-10-27 14:42   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®