diff options
author | Inki Dae <inki.dae@samsung.com> | 2014-11-25 14:25:12 +0900 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-11-24 22:44:57 -0800 |
commit | a39e2035bcc6502ce867807a70381f40543e4c72 (patch) | |
tree | c7322ace95c1c246854eb57cc43c45569ef24370 | |
parent | 6dbf2c990461699883d1a88406b8c270c314a2f4 (diff) | |
download | linux-3.10-a39e2035bcc6502ce867807a70381f40543e4c72.tar.gz linux-3.10-a39e2035bcc6502ce867807a70381f40543e4c72.tar.bz2 linux-3.10-a39e2035bcc6502ce867807a70381f40543e4c72.zip |
dma-buf/dmabuf-sync: fix request order check
This patch fixes infinite loop issue which could be incurred
when same task requested sync before previous sync of
the same task is signaled.
For this, it checks if the context of a given sync object is
same as previous one.
Change-Id: I214a3011de4a8513d9aea5f5d56d85acf3ffae7e
Signed-off-by: Inki Dae <inki.dae@samsung.com>
-rw-r--r-- | drivers/dma-buf/dmabuf-sync.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/dma-buf/dmabuf-sync.c b/drivers/dma-buf/dmabuf-sync.c index 790383855a0..5f51e17b12a 100644 --- a/drivers/dma-buf/dmabuf-sync.c +++ b/drivers/dma-buf/dmabuf-sync.c @@ -630,14 +630,21 @@ static bool is_higher_priority_than_current(struct dma_buf *dmabuf, bool ret = false; spin_lock_irqsave(&orders_lock, o_flags); - if (list_empty(&orders)) { + if (unlikely(list_empty(&orders))) { /* There should be no such case. */ WARN_ON(1); goto out; } list_for_each_entry(sobj, &orders, g_head) { - if (sobj != csobj) + struct seqno_fence *old_sf, *cur_sf; + + old_sf = sobj->sfence; + cur_sf = csobj->sfence; + WARN_ON(!old_sf || !cur_sf); + + if (old_sf->base.context != cur_sf->base.context && + sobj != csobj) ret = true; break; } |