提交 699f6855 编写于 作者: D Dmitry Torokhov 提交者: Greg Kroah-Hartman

android: unconditionally remove callbacks in sync_fence_free()

Using fence->status to determine whether or not there are callbacks
remaining on the sync_fence is racy since fence->status may have been
decremented to 0 on another CPU before fence_check_cb_func() has
completed.  By unconditionally calling fence_remove_callback() for each
fence in the sync_fence, we guarantee that each callback has either
completed (since fence_remove_callback() grabs the fence lock) or been
removed.
Signed-off-by: NAndrew Bresticker <abrestic@chromium.org>
Signed-off-by: NDmitry Torokhov <dtor@chromium.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 0f477c6d
......@@ -524,12 +524,10 @@ static const struct fence_ops android_fence_ops = {
static void sync_fence_free(struct kref *kref)
{
struct sync_fence *fence = container_of(kref, struct sync_fence, kref);
int i, status = atomic_read(&fence->status);
int i;
for (i = 0; i < fence->num_fences; ++i) {
if (status)
fence_remove_callback(fence->cbs[i].sync_pt,
&fence->cbs[i].cb);
fence_remove_callback(fence->cbs[i].sync_pt, &fence->cbs[i].cb);
fence_put(fence->cbs[i].sync_pt);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册