* [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* Re: [PATCH] thunderbolt: stream: Undo more if the start fails
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
0 siblings, 1 reply; 3+ messages in thread
From: Mika Westerberg @ 2026-10-27 14:33 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-usb, linux-kernel, Josef Bacik, stable, Andreas Noever,
Mika Westerberg, Yehezkel Bernat, Alan Borzeszkowski
Hi,
On Tue, Oct 27, 2026 at 03:24:52PM +0100, Greg Kroah-Hartman wrote:
> 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>
Do you want to take this directly via USB tree? Then,
Acked-by: Mika Westerberg (Intel) <westeri@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] thunderbolt: stream: Undo more if the start fails
2026-10-27 14:33 ` Mika Westerberg
@ 2026-10-27 14:42 ` Greg Kroah-Hartman
0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2026-10-27 14:42 UTC (permalink / raw)
To: Mika Westerberg
Cc: linux-usb, linux-kernel, Josef Bacik, stable, Andreas Noever,
Mika Westerberg, Yehezkel Bernat, Alan Borzeszkowski
On Tue, Oct 27, 2026 at 03:33:25PM +0100, Mika Westerberg wrote:
> Hi,
>
> On Tue, Oct 27, 2026 at 03:24:52PM +0100, Greg Kroah-Hartman wrote:
> > 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>
>
> Do you want to take this directly via USB tree? Then,
>
> Acked-by: Mika Westerberg (Intel) <westeri@kernel.org>
I can, thanks!
greg k-h
^ 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®