public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Todd Kjos <tkjos@android.com>
To: gregkh@linuxfoundation.org, arve@android.com,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	maco@google.com, tkjos@google.com, xuyiping@hisilicon.com,
	gengyanping@hisilicon.com, shiwanglai@hisilicon.com
Subject: [PATCH] binder: fix memory corruption in binder_transaction binder
Date: Tue,  5 Sep 2017 10:21:52 -0700	[thread overview]
Message-ID: <20170905172152.36227-1-tkjos@google.com> (raw)

From: Xu YiPing <xuyiping@hisilicon.com>

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.

Signed-off-by: Xu YiPing <xuyiping@hisilicon.com>
Signed-off-by: Todd Kjos <tkjos@google.com>
---
 drivers/android/binder.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index d055b3f2a207..96cc28afa383 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -3083,6 +3083,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:
-- 
2.14.1.581.gf28d330327-goog

             reply	other threads:[~2017-09-05 17:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-05 17:21 Todd Kjos [this message]
2017-09-11 12:18 ` [PATCH] binder: fix memory corruption in binder_transaction binder Amit Pundir
     [not found]   ` <CAHRSSEwVSHSoYJc8JEaAkNwG+v5Fgaq4sO7GZ7otHzyv9m+qFg@mail.gmail.com>
2017-09-11 15:40     ` Todd Kjos
2017-09-11 16:55       ` Amit Pundir
2017-09-11 17:24         ` Greg Kroah-Hartman
2017-09-11 19:59         ` Todd Kjos
2017-09-12  8:20           ` Martijn Coenen
2017-10-03  8:45             ` Amit Pundir

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170905172152.36227-1-tkjos@google.com \
    --to=tkjos@android.com \
    --cc=arve@android.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gengyanping@hisilicon.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maco@google.com \
    --cc=shiwanglai@hisilicon.com \
    --cc=tkjos@google.com \
    --cc=xuyiping@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox