From 54812d339b9a62be48d12ee5136c34882e8c2e8c Mon Sep 17 00:00:00 2001 From: Akhil P Oommen Date: Wed, 7 Jun 2017 16:13:37 +0530 Subject: [PATCH] staging: android: sync: fix list corruption in fence struct Fence lock is not taken in sync_print_fence() while calling sync_print_pt() which in turn calls fence_is_signaled() to check the status of each fence before printing. This creates a race condition that corrupts fence data structure when another thread calls fence_is_signaled_locked() on the same fence. Since we don't need to signal the fence while logging, it can be fixed by simply checking fence flag status directly instead of calling fence_is_signaled_locked(). Change-Id: I1b4732cf3779a5b75a372e11170b438a4deabe67 Signed-off-by: Akhil P Oommen --- drivers/staging/android/sync_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c index aaa96c3df45b..5fbd3766b981 100644 --- a/drivers/staging/android/sync_debug.c +++ b/drivers/staging/android/sync_debug.c @@ -87,7 +87,7 @@ static void sync_print_pt(struct seq_file *s, struct sync_pt *pt, bool fence) int status = 1; struct sync_timeline *parent = sync_pt_parent(pt); - if (fence_is_signaled_locked(&pt->base)) + if (test_bit(FENCE_FLAG_SIGNALED_BIT, &pt->base.flags)) status = pt->base.status; seq_printf(s, " %s%spt %s",