mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 22:50:41 +00:00
usb: gadget: functionfs: Fix inverted DMA fence direction
A "read" fence was installed when the DMABUF was to be written to, and a "write" fence was installed when the DMABUF was to be read from. Besides, dma_resv_usage_rw() should only be used when waiting for fences. Fixes: 7b07a2a7ca02 ("usb: gadget: functionfs: Add DMABUF import interface") Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20240402110951.16376-2-paul@crapouillou.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ce4c8d2105
commit
1500a7b279
@ -1578,6 +1578,7 @@ static int ffs_dmabuf_transfer(struct file *file,
|
||||
struct ffs_dmabuf_priv *priv;
|
||||
struct ffs_dma_fence *fence;
|
||||
struct usb_request *usb_req;
|
||||
enum dma_resv_usage resv_dir;
|
||||
struct dma_buf *dmabuf;
|
||||
struct ffs_ep *ep;
|
||||
bool cookie;
|
||||
@ -1665,8 +1666,9 @@ static int ffs_dmabuf_transfer(struct file *file,
|
||||
dma_fence_init(&fence->base, &ffs_dmabuf_fence_ops,
|
||||
&priv->lock, priv->context, seqno);
|
||||
|
||||
dma_resv_add_fence(dmabuf->resv, &fence->base,
|
||||
dma_resv_usage_rw(epfile->in));
|
||||
resv_dir = epfile->in ? DMA_RESV_USAGE_WRITE : DMA_RESV_USAGE_READ;
|
||||
|
||||
dma_resv_add_fence(dmabuf->resv, &fence->base, resv_dir);
|
||||
dma_resv_unlock(dmabuf->resv);
|
||||
|
||||
/* Now that the dma_fence is in place, queue the transfer. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user