binder: fix false BUG_ON
binder_enqueue_work asserts that the object is not already queued by testing if work->wlist != NULL. The assertion is outside the critical section, so it is possible that the assertion can trip when the work item is off the queue, but before work->wlist is cleared (as was the case in b/36511858). Move the assertion into the critical section so wlist check is atomic with the actual list. Bug: 36511858 Change-Id: I4d65e5abaa8a4bb0e3c122869ca8cca0991b83ed Test: tested manually Signed-off-by: Todd Kjos <tkjos@google.com>
This commit is contained in:
@@ -473,9 +473,9 @@ binder_enqueue_work(struct binder_work *work,
|
||||
binder_debug(BINDER_DEBUG_TODO_LISTS,
|
||||
"%s: line=%d last_line=%d\n", __func__,
|
||||
line, work->last_line);
|
||||
spin_lock(&target_wlist->lock);
|
||||
BUG_ON(work->wlist != NULL);
|
||||
BUG_ON(target_wlist == NULL);
|
||||
spin_lock(&target_wlist->lock);
|
||||
work->wlist = target_wlist;
|
||||
list_add_tail(&work->entry, &target_wlist->list);
|
||||
work->last_line = line;
|
||||
|
||||
Reference in New Issue
Block a user