summaryrefslogtreecommitdiffstats
path: root/drivers/dma-buf
diff options
context:
space:
mode:
authorDominik Behr <dbehr@chromium.org>2017-09-07 16:02:46 -0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-10 13:40:44 +0100
commit779bfa90bdf97a6d00459471f6d371f6036f3da5 (patch)
treee1c0f7f4e8eaa49533aefb1885d1e7715c71ac99 /drivers/dma-buf
parent1ffabfc1d58ba586fa11cc3cde21d54afec03387 (diff)
downloadlinux-stable-779bfa90bdf97a6d00459471f6d371f6036f3da5.tar.gz
linux-stable-779bfa90bdf97a6d00459471f6d371f6036f3da5.tar.bz2
linux-stable-779bfa90bdf97a6d00459471f6d371f6036f3da5.zip
dma-buf/sw_sync: force signal all unsignaled fences on dying timeline
commit ea4d5a270b57fa8d4871f372ca9b97b7697fdfda upstream. To avoid hanging userspace components that might have been waiting on the active fences of the destroyed timeline we need to signal with error all remaining fences on such timeline. This restore the default behaviour of the Android sw_sync framework, which Android still relies on. It was broken on the dma fence conversion a few years ago and never fixed. v2: Do not bother with cleanup do the list (Chris Wilson) Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Dominik Behr <dbehr@chromium.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/20170907190246.16425-2-gustavo@padovan.org Cc: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/dma-buf')
-rw-r--r--drivers/dma-buf/sw_sync.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c
index 38cc7389a6c1..24f83f9eeaed 100644
--- a/drivers/dma-buf/sw_sync.c
+++ b/drivers/dma-buf/sw_sync.c
@@ -321,8 +321,16 @@ static int sw_sync_debugfs_open(struct inode *inode, struct file *file)
static int sw_sync_debugfs_release(struct inode *inode, struct file *file)
{
struct sync_timeline *obj = file->private_data;
+ struct sync_pt *pt, *next;
+
+ spin_lock_irq(&obj->lock);
+
+ list_for_each_entry_safe(pt, next, &obj->pt_list, link) {
+ dma_fence_set_error(&pt->base, -ENOENT);
+ dma_fence_signal_locked(&pt->base);
+ }
- smp_wmb();
+ spin_unlock_irq(&obj->lock);
sync_timeline_put(obj);
return 0;