thunderbolt: stream: Restore consumer if copying from iter fails

In tbstream_dev_alloc_tx() if copying data from iterator fails we leave
the consumer pointer as is wasting one entry in the ring. Fix this by
restoring the consumer back in case of failure.

Fixes: 6db21d817b ("thunderbolt: Add support for USB4STREAM")
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
Mika Westerberg 2026-07-28 13:24:27 +03:00
parent 41365e558e
commit 039701ea3d

View File

@ -512,8 +512,10 @@ tbstream_dev_alloc_tx(struct tbstream_dev *sdev, enum tbstream_frame_pdf pdf,
dma_sync_single_for_cpu(dma_dev, sf->frame.buffer_phy, size,
DMA_TO_DEVICE);
if (pdf == TBSTREAM_DATA) {
if (copy_page_from_iter(sf->page, 0, size, from) != size)
if (copy_page_from_iter(sf->page, 0, size, from) != size) {
sdev->tx_ring.cons--;
return ERR_PTR(-EFAULT);
}
} else {
memset(page_address(sf->page), 0, size);
}