FROMLIST: binder: fix memory corruption in binder_transaction binder
authorXu YiPing <xuyiping@hisilicon.com>
Mon, 22 May 2017 18:26:23 +0000 (11:26 -0700)
committerDanny Wood <danwood76@gmail.com>
Fri, 8 Nov 2019 12:03:12 +0000 (12:03 +0000)
(from https://patchwork.kernel.org/patch/9939405/)

commit 7a4408c6bd3e ("binder: make sure accesses to proc/thread are
safe") made a change to enqueue tcomplete to thread->todo before
enqueuing the transaction. However, in err_dead_proc_or_thread case,
the tcomplete is directly freed, without dequeued. It may cause the
thread->todo list to be corrupted.

So, dequeue it before freeing.

Bug: 65333488
Change-Id: Id063a4db18deaa634f4d44aa6ebca47bea32537a
Signed-off-by: Xu YiPing <xuyiping@hisilicon.com>
Signed-off-by: Todd Kjos <tkjos@google.com>
drivers/android/binder.c

index 47d5f77772bcc64282680db030fae67026cf3564..a4a94831d556071cb9cc761d029d5f5f3693b8f7 100644 (file)
@@ -3260,6 +3260,7 @@ static void binder_transaction(struct binder_proc *proc,
 err_dead_proc_or_thread:
        return_error = BR_DEAD_REPLY;
        return_error_line = __LINE__;
+       binder_dequeue_work(proc, tcomplete);
 err_translate_failed:
 err_bad_object_type:
 err_bad_offset: