sync: reorder sync_fence_release
authorErik Gilling <konkers@android.com>
Thu, 12 Jul 2012 00:07:39 +0000 (17:07 -0700)
committer黄涛 <huangtao@rock-chips.com>
Fri, 22 Feb 2013 09:46:57 +0000 (17:46 +0800)
Previously fence's pts were freed before the were the fence was removed from the
global fence list.  This led to a race with the debugfs support where it would
iterate over sync_pts that had been freed.

Change-Id: Ia3ddbf77de42ca593fc2dc353b5d04e42ddf3946
Signed-off-by: Erik Gilling <konkers@android.com>
drivers/base/sync.c

index 0fcc720557e65771a355c5e2719880d6c75c9450..f85a1c5502a06e859c829450aa5f191714f7f72f 100644 (file)
@@ -520,12 +520,12 @@ static int sync_fence_release(struct inode *inode, struct file *file)
        struct sync_fence *fence = file->private_data;
        unsigned long flags;
 
-       sync_fence_free_pts(fence);
-
        spin_lock_irqsave(&sync_fence_list_lock, flags);
        list_del(&fence->sync_fence_list);
        spin_unlock_irqrestore(&sync_fence_list_lock, flags);
 
+       sync_fence_free_pts(fence);
+
        kfree(fence);
 
        return 0;