mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-12-05 01:50:55 -06:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user