stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4.4,4.9] binder: add missing binder_unlock()
@ 2018-02-26 18:56 Eric Biggers
  2018-02-26 19:04 ` Todd Kjos
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Eric Biggers @ 2018-02-26 18:56 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman; +Cc: Guenter Roeck, Todd Kjos, Eric Biggers

From: Eric Biggers <ebiggers@google.com>

[Please apply to 4.4-stable and 4.9-stable.]

When commit 4be5a2810489 ("binder: check for binder_thread allocation
failure in binder_poll()") was applied to 4.4-stable and 4.9-stable it
was forgotten to release the global binder lock in the new error path.
The global binder lock wasn't removed until v4.14, by commit
a60b890f607d ("binder: remove global binder lock").

Fix the new error path to release the lock.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 drivers/android/binder.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index 3b6ac80b2127..49199bd2ab93 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -2628,8 +2628,10 @@ static unsigned int binder_poll(struct file *filp,
 	binder_lock(__func__);
 
 	thread = binder_get_thread(proc);
-	if (!thread)
+	if (!thread) {
+		binder_unlock(__func__);
 		return POLLERR;
+	}
 
 	wait_for_proc_work = thread->transaction_stack == NULL &&
 		list_empty(&thread->todo) && thread->return_error == BR_OK;
-- 
2.16.1.291.g4437f3f132-goog

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 4.4,4.9] binder: add missing binder_unlock()
  2018-02-26 18:56 [PATCH 4.4,4.9] binder: add missing binder_unlock() Eric Biggers
@ 2018-02-26 19:04 ` Todd Kjos
  2018-02-26 19:36 ` Patch "binder: add missing binder_unlock()" has been added to the 4.4-stable tree gregkh
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Todd Kjos @ 2018-02-26 19:04 UTC (permalink / raw)
  To: Eric Biggers
  Cc: stable, Greg Kroah-Hartman, Guenter Roeck, Todd Kjos,
	Eric Biggers, Martijn Coenen

Ack. Agree this is needed for pre-4.14.

On Mon, Feb 26, 2018 at 10:56 AM, Eric Biggers <ebiggers3@gmail.com> wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> [Please apply to 4.4-stable and 4.9-stable.]
>
> When commit 4be5a2810489 ("binder: check for binder_thread allocation
> failure in binder_poll()") was applied to 4.4-stable and 4.9-stable it
> was forgotten to release the global binder lock in the new error path.
> The global binder lock wasn't removed until v4.14, by commit
> a60b890f607d ("binder: remove global binder lock").
>
> Fix the new error path to release the lock.
>
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  drivers/android/binder.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/android/binder.c b/drivers/android/binder.c
> index 3b6ac80b2127..49199bd2ab93 100644
> --- a/drivers/android/binder.c
> +++ b/drivers/android/binder.c
> @@ -2628,8 +2628,10 @@ static unsigned int binder_poll(struct file *filp,
>         binder_lock(__func__);
>
>         thread = binder_get_thread(proc);
> -       if (!thread)
> +       if (!thread) {
> +               binder_unlock(__func__);
>                 return POLLERR;
> +       }
>
>         wait_for_proc_work = thread->transaction_stack == NULL &&
>                 list_empty(&thread->todo) && thread->return_error == BR_OK;
> --
> 2.16.1.291.g4437f3f132-goog
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Patch "binder: add missing binder_unlock()" has been added to the 4.4-stable tree
  2018-02-26 18:56 [PATCH 4.4,4.9] binder: add missing binder_unlock() Eric Biggers
  2018-02-26 19:04 ` Todd Kjos
@ 2018-02-26 19:36 ` gregkh
  2018-02-26 19:37 ` [PATCH 4.4,4.9] binder: add missing binder_unlock() Greg Kroah-Hartman
  2018-02-26 19:37 ` Patch "binder: add missing binder_unlock()" has been added to the 4.9-stable tree gregkh
  3 siblings, 0 replies; 5+ messages in thread
From: gregkh @ 2018-02-26 19:36 UTC (permalink / raw)
  To: ebiggers3, ebiggers, gregkh, linux, tkjos; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    binder: add missing binder_unlock()

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     binder-add-missing-binder_unlock.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From ebiggers3@gmail.com  Mon Feb 26 20:36:21 2018
From: Eric Biggers <ebiggers3@gmail.com>
Date: Mon, 26 Feb 2018 10:56:45 -0800
Subject: binder: add missing binder_unlock()
To: stable@vger.kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Guenter Roeck <linux@roeck-us.net>, Todd Kjos <tkjos@android.com>, Eric Biggers <ebiggers@google.com>
Message-ID: <20180226185645.241652-1-ebiggers3@gmail.com>


From: Eric Biggers <ebiggers@google.com>

When commit 4be5a2810489 ("binder: check for binder_thread allocation
failure in binder_poll()") was applied to 4.4-stable and 4.9-stable it
was forgotten to release the global binder lock in the new error path.
The global binder lock wasn't removed until v4.14, by commit
a60b890f607d ("binder: remove global binder lock").

Fix the new error path to release the lock.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/android/binder.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -2622,8 +2622,10 @@ static unsigned int binder_poll(struct f
 	binder_lock(__func__);
 
 	thread = binder_get_thread(proc);
-	if (!thread)
+	if (!thread) {
+		binder_unlock(__func__);
 		return POLLERR;
+	}
 
 	wait_for_proc_work = thread->transaction_stack == NULL &&
 		list_empty(&thread->todo) && thread->return_error == BR_OK;


Patches currently in stable-queue which might be from ebiggers3@gmail.com are

queue-4.4/binder-add-missing-binder_unlock.patch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4.4,4.9] binder: add missing binder_unlock()
  2018-02-26 18:56 [PATCH 4.4,4.9] binder: add missing binder_unlock() Eric Biggers
  2018-02-26 19:04 ` Todd Kjos
  2018-02-26 19:36 ` Patch "binder: add missing binder_unlock()" has been added to the 4.4-stable tree gregkh
@ 2018-02-26 19:37 ` Greg Kroah-Hartman
  2018-02-26 19:37 ` Patch "binder: add missing binder_unlock()" has been added to the 4.9-stable tree gregkh
  3 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2018-02-26 19:37 UTC (permalink / raw)
  To: Eric Biggers; +Cc: stable, Guenter Roeck, Todd Kjos, Eric Biggers

On Mon, Feb 26, 2018 at 10:56:45AM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> [Please apply to 4.4-stable and 4.9-stable.]
> 
> When commit 4be5a2810489 ("binder: check for binder_thread allocation
> failure in binder_poll()") was applied to 4.4-stable and 4.9-stable it
> was forgotten to release the global binder lock in the new error path.
> The global binder lock wasn't removed until v4.14, by commit
> a60b890f607d ("binder: remove global binder lock").
> 
> Fix the new error path to release the lock.
> 
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  drivers/android/binder.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/android/binder.c b/drivers/android/binder.c
> index 3b6ac80b2127..49199bd2ab93 100644
> --- a/drivers/android/binder.c
> +++ b/drivers/android/binder.c
> @@ -2628,8 +2628,10 @@ static unsigned int binder_poll(struct file *filp,
>  	binder_lock(__func__);
>  
>  	thread = binder_get_thread(proc);
> -	if (!thread)
> +	if (!thread) {
> +		binder_unlock(__func__);
>  		return POLLERR;
> +	}
>  
>  	wait_for_proc_work = thread->transaction_stack == NULL &&
>  		list_empty(&thread->todo) && thread->return_error == BR_OK;
> -- 
> 2.16.1.291.g4437f3f132-goog

Thanks for the patch, all now queued up.

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Patch "binder: add missing binder_unlock()" has been added to the 4.9-stable tree
  2018-02-26 18:56 [PATCH 4.4,4.9] binder: add missing binder_unlock() Eric Biggers
                   ` (2 preceding siblings ...)
  2018-02-26 19:37 ` [PATCH 4.4,4.9] binder: add missing binder_unlock() Greg Kroah-Hartman
@ 2018-02-26 19:37 ` gregkh
  3 siblings, 0 replies; 5+ messages in thread
From: gregkh @ 2018-02-26 19:37 UTC (permalink / raw)
  To: ebiggers3, ebiggers, gregkh, linux, tkjos; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    binder: add missing binder_unlock()

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     binder-add-missing-binder_unlock.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From ebiggers3@gmail.com  Mon Feb 26 20:36:21 2018
From: Eric Biggers <ebiggers3@gmail.com>
Date: Mon, 26 Feb 2018 10:56:45 -0800
Subject: binder: add missing binder_unlock()
To: stable@vger.kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Guenter Roeck <linux@roeck-us.net>, Todd Kjos <tkjos@android.com>, Eric Biggers <ebiggers@google.com>
Message-ID: <20180226185645.241652-1-ebiggers3@gmail.com>


From: Eric Biggers <ebiggers@google.com>

When commit 4be5a2810489 ("binder: check for binder_thread allocation
failure in binder_poll()") was applied to 4.4-stable and 4.9-stable it
was forgotten to release the global binder lock in the new error path.
The global binder lock wasn't removed until v4.14, by commit
a60b890f607d ("binder: remove global binder lock").

Fix the new error path to release the lock.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/android/binder.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -2628,8 +2628,10 @@ static unsigned int binder_poll(struct f
 	binder_lock(__func__);
 
 	thread = binder_get_thread(proc);
-	if (!thread)
+	if (!thread) {
+		binder_unlock(__func__);
 		return POLLERR;
+	}
 
 	wait_for_proc_work = thread->transaction_stack == NULL &&
 		list_empty(&thread->todo) && thread->return_error == BR_OK;


Patches currently in stable-queue which might be from ebiggers3@gmail.com are

queue-4.9/binder-add-missing-binder_unlock.patch

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-26 19:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-26 18:56 [PATCH 4.4,4.9] binder: add missing binder_unlock() Eric Biggers
2018-02-26 19:04 ` Todd Kjos
2018-02-26 19:36 ` Patch "binder: add missing binder_unlock()" has been added to the 4.4-stable tree gregkh
2018-02-26 19:37 ` [PATCH 4.4,4.9] binder: add missing binder_unlock() Greg Kroah-Hartman
2018-02-26 19:37 ` Patch "binder: add missing binder_unlock()" has been added to the 4.9-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).