Skip to contentSkip to conversation

thunderbolt: stream: Undo more if the start fails

PATCH In review Greg Kroah-Hartman 3 participants 4 messages Oct 27

Subsystems (2)
lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

PATCH 1/1 thunderbolt: stream: Undo more if the start fails

From: Josef Bacik <[email protected]>

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 <[email protected]>
Cc Andreas Noever <[email protected]>
Cc Mika Westerberg <[email protected]>
Cc Yehezkel Bernat <[email protected]>
Cc Alan Borzeszkowski <[email protected]>
---
 drivers/thunderbolt/stream.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/thunderbolt/stream.c +6 -0
index 4f9a57b77bfa..c9e1987a6924 100644
@@ -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:
Signature · 1 line
2.56.0
#1 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 11 lines

From: Josef Bacik <[email protected]>

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.

Quoted 8 lines
Fixes 6db21d817b43 ("thunderbolt: Add support for USB4STREAM")
Cc stable <[email protected]>
Cc Andreas Noever <[email protected]>
Cc Mika Westerberg <[email protected]>
Cc Yehezkel Bernat <[email protected]>
Cc Alan Borzeszkowski <[email protected]>

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/2026102751-nibble-synapse-d406@gregkh?part=1
Acked-by Mika Westerberg (Intel) on v1 1/1
#2 lore raw
In reply to Greg Kroah-Hartman

Hi,

Quoted 11 lines · Greg Kroah-Hartman

From: Josef Bacik <[email protected]>

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.

Quoted 4 lines
Fixes 6db21d817b43 ("thunderbolt: Add support for USB4STREAM")
Cc stable <[email protected]>
Cc Andreas Noever <[email protected]>
Cc Mika Westerberg <[email protected]>

Do you want to take this directly via USB tree? Then,

author maintainer
#3 lore raw
Quoted 14 lines · Mika Westerberg

Hi,

Quoted 11 lines · Greg Kroah-Hartman

From: Josef Bacik <[email protected]>

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.

Quoted 8 lines
Quoted 4 lines
Fixes 6db21d817b43 ("thunderbolt: Add support for USB4STREAM")
Cc stable <[email protected]>
Cc Andreas Noever <[email protected]>
Cc Mika Westerberg <[email protected]>

Do you want to take this directly via USB tree? Then,

I can, thanks!

greg k-h