summaryrefslogtreecommitdiff
path: root/drivers/dma-buf/dma-fence.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2022-09-19 15:00:33 +0300
committerChristian König <christian.koenig@amd.com>2022-09-19 21:45:17 +0300
commit3cc3dd73c420dc70cd366f91a680035ef47edf4f (patch)
tree15613c12c8a5b9565f5a7196c7bbd6246cca8fe8 /drivers/dma-buf/dma-fence.c
parented712d30a9d0b8a59d6ed001cc7711d7b9c5ce54 (diff)
downloadlinux-3cc3dd73c420dc70cd366f91a680035ef47edf4f.tar.xz
dma-buf: fix dma_fence_default_wait() signaling check
That check must now come after grabing the spinlock, not before. Signed-off-by: Christian König <christian.koenig@amd.com> Fixes: b96fb1e724ae ("dma-buf: dma_fence_wait must enable signaling") Acked-by: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220919120618.113332-1-christian.koenig@amd.com
Diffstat (limited to 'drivers/dma-buf/dma-fence.c')
-rw-r--r--drivers/dma-buf/dma-fence.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index a5fbf1c1e0ea..406b4e26f538 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -763,11 +763,11 @@ dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout)
unsigned long flags;
signed long ret = timeout ? timeout : 1;
- if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
- return ret;
-
spin_lock_irqsave(fence->lock, flags);
+ if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
+ goto out;
+
if (intr && signal_pending(current)) {
ret = -ERESTARTSYS;
goto out;