* [PATCH 01/21] binder: use EPOLLERR from eventpoll.h
[not found] <20231102185934.773885-1-cmllamas@google.com>
@ 2023-11-02 18:59 ` Carlos Llamas
2023-11-07 9:07 ` Alice Ryhl
2023-11-02 18:59 ` [PATCH 02/21] binder: fix use-after-free in shinker's callback Carlos Llamas
` (2 subsequent siblings)
3 siblings, 1 reply; 12+ messages in thread
From: Carlos Llamas @ 2023-11-02 18:59 UTC (permalink / raw)
To: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
Suren Baghdasaryan, Eric Biggers
Cc: linux-kernel, kernel-team, stable
Use EPOLLERR instead of POLLERR to make sure it is cast to the correct
__poll_t type. This fixes the following sparse issue:
drivers/android/binder.c:5030:24: warning: incorrect type in return expression (different base types)
drivers/android/binder.c:5030:24: expected restricted __poll_t
drivers/android/binder.c:5030:24: got int
Fixes: f88982679f54 ("binder: check for binder_thread allocation failure in binder_poll()")
Cc: stable@vger.kernel.org
Cc: Eric Biggers <ebiggers@google.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
---
drivers/android/binder.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index 92128aae2d06..71a40a4c546f 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -5030,7 +5030,7 @@ static __poll_t binder_poll(struct file *filp,
thread = binder_get_thread(proc);
if (!thread)
- return POLLERR;
+ return EPOLLERR;
binder_inner_proc_lock(thread->proc);
thread->looper |= BINDER_LOOPER_STATE_POLL;
--
2.42.0.869.gea05f2083d-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 01/21] binder: use EPOLLERR from eventpoll.h
2023-11-02 18:59 ` [PATCH 01/21] binder: use EPOLLERR from eventpoll.h Carlos Llamas
@ 2023-11-07 9:07 ` Alice Ryhl
0 siblings, 0 replies; 12+ messages in thread
From: Alice Ryhl @ 2023-11-07 9:07 UTC (permalink / raw)
To: Carlos Llamas
Cc: Arve Hjønnevåg, Christian Brauner, Eric Biggers,
Greg Kroah-Hartman, Joel Fernandes, Martijn Coenen,
Suren Baghdasaryan, Todd Kjos, kernel-team, linux-kernel, stable
Carlos Llamas <cmllamas@google.com> writes:
> Use EPOLLERR instead of POLLERR to make sure it is cast to the correct
> __poll_t type. This fixes the following sparse issue:
>
> drivers/android/binder.c:5030:24: warning: incorrect type in return expression (different base types)
> drivers/android/binder.c:5030:24: expected restricted __poll_t
> drivers/android/binder.c:5030:24: got int
>
> Fixes: f88982679f54 ("binder: check for binder_thread allocation failure in binder_poll()")
> Cc: stable@vger.kernel.org
> Cc: Eric Biggers <ebiggers@google.com>
> Signed-off-by: Carlos Llamas <cmllamas@google.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 02/21] binder: fix use-after-free in shinker's callback
[not found] <20231102185934.773885-1-cmllamas@google.com>
2023-11-02 18:59 ` [PATCH 01/21] binder: use EPOLLERR from eventpoll.h Carlos Llamas
@ 2023-11-02 18:59 ` Carlos Llamas
2023-11-02 19:20 ` Liam R. Howlett
2023-11-07 9:07 ` Alice Ryhl
2023-11-02 18:59 ` [PATCH 05/21] binder: fix trivial typo of binder_free_buf_locked() Carlos Llamas
2023-11-02 18:59 ` [PATCH 06/21] binder: fix comment on binder_alloc_new_buf() return value Carlos Llamas
3 siblings, 2 replies; 12+ messages in thread
From: Carlos Llamas @ 2023-11-02 18:59 UTC (permalink / raw)
To: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
Suren Baghdasaryan, Andrew Morton, Vlastimil Babka,
Kirill A. Shutemov, Matthew Wilcox, Michal Hocko
Cc: linux-kernel, kernel-team, stable, Liam Howlett, Minchan Kim
The mmap read lock is used during the shrinker's callback, which means
that using alloc->vma pointer isn't safe as it can race with munmap().
As of commit dd2283f2605e ("mm: mmap: zap pages with read mmap_sem in
munmap") the mmap lock is downgraded after the vma has been isolated.
I was able to reproduce this issue by manually adding some delays and
triggering page reclaiming through the shrinker's debug sysfs. The
following KASAN report confirms the UAF:
==================================================================
BUG: KASAN: slab-use-after-free in zap_page_range_single+0x470/0x4b8
Read of size 8 at addr ffff356ed50e50f0 by task bash/478
CPU: 1 PID: 478 Comm: bash Not tainted 6.6.0-rc5-00055-g1c8b86a3799f-dirty #70
Hardware name: linux,dummy-virt (DT)
Call trace:
zap_page_range_single+0x470/0x4b8
binder_alloc_free_page+0x608/0xadc
__list_lru_walk_one+0x130/0x3b0
list_lru_walk_node+0xc4/0x22c
binder_shrink_scan+0x108/0x1dc
shrinker_debugfs_scan_write+0x2b4/0x500
full_proxy_write+0xd4/0x140
vfs_write+0x1ac/0x758
ksys_write+0xf0/0x1dc
__arm64_sys_write+0x6c/0x9c
Allocated by task 492:
kmem_cache_alloc+0x130/0x368
vm_area_alloc+0x2c/0x190
mmap_region+0x258/0x18bc
do_mmap+0x694/0xa60
vm_mmap_pgoff+0x170/0x29c
ksys_mmap_pgoff+0x290/0x3a0
__arm64_sys_mmap+0xcc/0x144
Freed by task 491:
kmem_cache_free+0x17c/0x3c8
vm_area_free_rcu_cb+0x74/0x98
rcu_core+0xa38/0x26d4
rcu_core_si+0x10/0x1c
__do_softirq+0x2fc/0xd24
Last potentially related work creation:
__call_rcu_common.constprop.0+0x6c/0xba0
call_rcu+0x10/0x1c
vm_area_free+0x18/0x24
remove_vma+0xe4/0x118
do_vmi_align_munmap.isra.0+0x718/0xb5c
do_vmi_munmap+0xdc/0x1fc
__vm_munmap+0x10c/0x278
__arm64_sys_munmap+0x58/0x7c
Fix this issue by performing instead a vma_lookup() which will fail to
find the vma that was isolated before the mmap lock downgrade. Note that
this option has better performance than upgrading to a mmap write lock
which would increase contention. Plus, mmap_write_trylock() has been
recently removed anyway.
Fixes: dd2283f2605e ("mm: mmap: zap pages with read mmap_sem in munmap")
Cc: stable@vger.kernel.org
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
---
drivers/android/binder_alloc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c
index e3db8297095a..c4d60d81221b 100644
--- a/drivers/android/binder_alloc.c
+++ b/drivers/android/binder_alloc.c
@@ -1005,7 +1005,9 @@ enum lru_status binder_alloc_free_page(struct list_head *item,
goto err_mmget;
if (!mmap_read_trylock(mm))
goto err_mmap_read_lock_failed;
- vma = binder_alloc_get_vma(alloc);
+ vma = vma_lookup(mm, page_addr);
+ if (vma && vma != binder_alloc_get_vma(alloc))
+ goto err_invalid_vma;
list_lru_isolate(lru, item);
spin_unlock(lock);
@@ -1031,6 +1033,8 @@ enum lru_status binder_alloc_free_page(struct list_head *item,
mutex_unlock(&alloc->mutex);
return LRU_REMOVED_RETRY;
+err_invalid_vma:
+ mmap_read_unlock(mm);
err_mmap_read_lock_failed:
mmput_async(mm);
err_mmget:
--
2.42.0.869.gea05f2083d-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 02/21] binder: fix use-after-free in shinker's callback
2023-11-02 18:59 ` [PATCH 02/21] binder: fix use-after-free in shinker's callback Carlos Llamas
@ 2023-11-02 19:20 ` Liam R. Howlett
2023-11-02 20:09 ` Carlos Llamas
2023-11-07 9:07 ` Alice Ryhl
1 sibling, 1 reply; 12+ messages in thread
From: Liam R. Howlett @ 2023-11-02 19:20 UTC (permalink / raw)
To: Carlos Llamas
Cc: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
Martijn Coenen, Joel Fernandes, Christian Brauner,
Suren Baghdasaryan, Andrew Morton, Vlastimil Babka,
Kirill A. Shutemov, Matthew Wilcox, Michal Hocko, linux-kernel,
kernel-team, stable, Minchan Kim
* Carlos Llamas <cmllamas@google.com> [231102 15:00]:
> The mmap read lock is used during the shrinker's callback, which means
> that using alloc->vma pointer isn't safe as it can race with munmap().
I think you know my feelings about the safety of that pointer from
previous discussions.
> As of commit dd2283f2605e ("mm: mmap: zap pages with read mmap_sem in
> munmap") the mmap lock is downgraded after the vma has been isolated.
>
> I was able to reproduce this issue by manually adding some delays and
> triggering page reclaiming through the shrinker's debug sysfs. The
> following KASAN report confirms the UAF:
>
> ==================================================================
> BUG: KASAN: slab-use-after-free in zap_page_range_single+0x470/0x4b8
> Read of size 8 at addr ffff356ed50e50f0 by task bash/478
>
> CPU: 1 PID: 478 Comm: bash Not tainted 6.6.0-rc5-00055-g1c8b86a3799f-dirty #70
> Hardware name: linux,dummy-virt (DT)
> Call trace:
> zap_page_range_single+0x470/0x4b8
> binder_alloc_free_page+0x608/0xadc
> __list_lru_walk_one+0x130/0x3b0
> list_lru_walk_node+0xc4/0x22c
> binder_shrink_scan+0x108/0x1dc
> shrinker_debugfs_scan_write+0x2b4/0x500
> full_proxy_write+0xd4/0x140
> vfs_write+0x1ac/0x758
> ksys_write+0xf0/0x1dc
> __arm64_sys_write+0x6c/0x9c
>
> Allocated by task 492:
> kmem_cache_alloc+0x130/0x368
> vm_area_alloc+0x2c/0x190
> mmap_region+0x258/0x18bc
> do_mmap+0x694/0xa60
> vm_mmap_pgoff+0x170/0x29c
> ksys_mmap_pgoff+0x290/0x3a0
> __arm64_sys_mmap+0xcc/0x144
>
> Freed by task 491:
> kmem_cache_free+0x17c/0x3c8
> vm_area_free_rcu_cb+0x74/0x98
> rcu_core+0xa38/0x26d4
> rcu_core_si+0x10/0x1c
> __do_softirq+0x2fc/0xd24
>
> Last potentially related work creation:
> __call_rcu_common.constprop.0+0x6c/0xba0
> call_rcu+0x10/0x1c
> vm_area_free+0x18/0x24
> remove_vma+0xe4/0x118
> do_vmi_align_munmap.isra.0+0x718/0xb5c
> do_vmi_munmap+0xdc/0x1fc
> __vm_munmap+0x10c/0x278
> __arm64_sys_munmap+0x58/0x7c
>
> Fix this issue by performing instead a vma_lookup() which will fail to
> find the vma that was isolated before the mmap lock downgrade. Note that
> this option has better performance than upgrading to a mmap write lock
> which would increase contention. Plus, mmap_write_trylock() has been
> recently removed anyway.
>
> Fixes: dd2283f2605e ("mm: mmap: zap pages with read mmap_sem in munmap")
> Cc: stable@vger.kernel.org
> Cc: Liam Howlett <liam.howlett@oracle.com>
> Cc: Minchan Kim <minchan@kernel.org>
> Signed-off-by: Carlos Llamas <cmllamas@google.com>
> ---
> drivers/android/binder_alloc.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c
> index e3db8297095a..c4d60d81221b 100644
> --- a/drivers/android/binder_alloc.c
> +++ b/drivers/android/binder_alloc.c
> @@ -1005,7 +1005,9 @@ enum lru_status binder_alloc_free_page(struct list_head *item,
> goto err_mmget;
> if (!mmap_read_trylock(mm))
> goto err_mmap_read_lock_failed;
> - vma = binder_alloc_get_vma(alloc);
> + vma = vma_lookup(mm, page_addr);
> + if (vma && vma != binder_alloc_get_vma(alloc))
> + goto err_invalid_vma;
Doesn't this need to be:
if (!vma || vma != binder_alloc_get_vma(alloc))
This way, we catch a different vma and a NULL vma.
Or even, just:
if (vma != binder_alloc_get_vma(alloc))
if the alloc vma cannot be NULL?
>
> list_lru_isolate(lru, item);
> spin_unlock(lock);
> @@ -1031,6 +1033,8 @@ enum lru_status binder_alloc_free_page(struct list_head *item,
> mutex_unlock(&alloc->mutex);
> return LRU_REMOVED_RETRY;
>
> +err_invalid_vma:
> + mmap_read_unlock(mm);
> err_mmap_read_lock_failed:
> mmput_async(mm);
> err_mmget:
> --
> 2.42.0.869.gea05f2083d-goog
>
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH 02/21] binder: fix use-after-free in shinker's callback
2023-11-02 19:20 ` Liam R. Howlett
@ 2023-11-02 20:09 ` Carlos Llamas
2023-11-02 20:27 ` Liam R. Howlett
0 siblings, 1 reply; 12+ messages in thread
From: Carlos Llamas @ 2023-11-02 20:09 UTC (permalink / raw)
To: Liam R. Howlett
Cc: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
Martijn Coenen, Joel Fernandes, Christian Brauner,
Suren Baghdasaryan, Andrew Morton, Vlastimil Babka,
Kirill A. Shutemov, Matthew Wilcox, Michal Hocko, linux-kernel,
kernel-team, stable, Minchan Kim
On Thu, Nov 02, 2023 at 03:20:51PM -0400, Liam R. Howlett wrote:
> * Carlos Llamas <cmllamas@google.com> [231102 15:00]:
> > The mmap read lock is used during the shrinker's callback, which means
> > that using alloc->vma pointer isn't safe as it can race with munmap().
>
> I think you know my feelings about the safety of that pointer from
> previous discussions.
>
Yeah. The work here is not done. We actually already store the vm_start
address in alloc->buffer, so in theory we don't even need to swap the
alloc->vma pointer we could just drop it. So, I agree with you.
I want to include this saftey "fix" along with some other work that uses
the page fault handler and get_user_pages_remote(). I've tried a quick
prototype of this and it works fine.
> > diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c
> > index e3db8297095a..c4d60d81221b 100644
> > --- a/drivers/android/binder_alloc.c
> > +++ b/drivers/android/binder_alloc.c
> > @@ -1005,7 +1005,9 @@ enum lru_status binder_alloc_free_page(struct list_head *item,
> > goto err_mmget;
> > if (!mmap_read_trylock(mm))
> > goto err_mmap_read_lock_failed;
> > - vma = binder_alloc_get_vma(alloc);
> > + vma = vma_lookup(mm, page_addr);
> > + if (vma && vma != binder_alloc_get_vma(alloc))
> > + goto err_invalid_vma;
>
> Doesn't this need to be:
> if (!vma || vma != binder_alloc_get_vma(alloc))
>
> This way, we catch a different vma and a NULL vma.
>
> Or even, just:
> if (vma != binder_alloc_get_vma(alloc))
>
> if the alloc vma cannot be NULL?
>
If the vma_lookup() is NULL then we still need to isolate and free the
given binder page and we obviously skip the zap() in this case.
However, if we receive a random unexpected vma because of a corrupted
address or similar, then the whole process is skipped.
Thus, why we use the check above.
--
Carlos Llamas
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 02/21] binder: fix use-after-free in shinker's callback
2023-11-02 20:09 ` Carlos Llamas
@ 2023-11-02 20:27 ` Liam R. Howlett
0 siblings, 0 replies; 12+ messages in thread
From: Liam R. Howlett @ 2023-11-02 20:27 UTC (permalink / raw)
To: Carlos Llamas
Cc: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
Martijn Coenen, Joel Fernandes, Christian Brauner,
Suren Baghdasaryan, Andrew Morton, Vlastimil Babka,
Kirill A. Shutemov, Matthew Wilcox, Michal Hocko, linux-kernel,
kernel-team, stable, Minchan Kim
* Carlos Llamas <cmllamas@google.com> [231102 16:09]:
...
>
> > > diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c
> > > index e3db8297095a..c4d60d81221b 100644
> > > --- a/drivers/android/binder_alloc.c
> > > +++ b/drivers/android/binder_alloc.c
> > > @@ -1005,7 +1005,9 @@ enum lru_status binder_alloc_free_page(struct list_head *item,
> > > goto err_mmget;
> > > if (!mmap_read_trylock(mm))
> > > goto err_mmap_read_lock_failed;
> > > - vma = binder_alloc_get_vma(alloc);
> > > + vma = vma_lookup(mm, page_addr);
> > > + if (vma && vma != binder_alloc_get_vma(alloc))
> > > + goto err_invalid_vma;
> >
> > Doesn't this need to be:
> > if (!vma || vma != binder_alloc_get_vma(alloc))
> >
> > This way, we catch a different vma and a NULL vma.
> >
> > Or even, just:
> > if (vma != binder_alloc_get_vma(alloc))
> >
> > if the alloc vma cannot be NULL?
> >
>
> If the vma_lookup() is NULL then we still need to isolate and free the
> given binder page and we obviously skip the zap() in this case.
I would have thought if there was no VMA, then the entire process could
be avoided. Thanks for clarifying.
>
> However, if we receive a random unexpected vma because of a corrupted
> address or similar, then the whole process is skipped.
>
> Thus, why we use the check above.
>
> --
> Carlos Llamas
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 02/21] binder: fix use-after-free in shinker's callback
2023-11-02 18:59 ` [PATCH 02/21] binder: fix use-after-free in shinker's callback Carlos Llamas
2023-11-02 19:20 ` Liam R. Howlett
@ 2023-11-07 9:07 ` Alice Ryhl
1 sibling, 0 replies; 12+ messages in thread
From: Alice Ryhl @ 2023-11-07 9:07 UTC (permalink / raw)
To: Carlos Llamas
Cc: Liam R . Howlett, Andrew Morton, Arve Hjønnevåg,
Christian Brauner, Greg Kroah-Hartman, Joel Fernandes,
Kirill A . Shutemov, Martijn Coenen, Michal Hocko, Minchan Kim,
Suren Baghdasaryan, Todd Kjos, Vlastimil Babka, Matthew Wilcox,
linux-kernel, kernel-team, stable
Carlos Llamas <cmllamas@google.com> writes:
> The mmap read lock is used during the shrinker's callback, which means
> that using alloc->vma pointer isn't safe as it can race with munmap().
> As of commit dd2283f2605e ("mm: mmap: zap pages with read mmap_sem in
> munmap") the mmap lock is downgraded after the vma has been isolated.
>
> I was able to reproduce this issue by manually adding some delays and
> triggering page reclaiming through the shrinker's debug sysfs. The
> following KASAN report confirms the UAF:
>
> [...snip...]
>
> Fix this issue by performing instead a vma_lookup() which will fail to
> find the vma that was isolated before the mmap lock downgrade. Note that
> this option has better performance than upgrading to a mmap write lock
> which would increase contention. Plus, mmap_write_trylock() has been
> recently removed anyway.
>
> Fixes: dd2283f2605e ("mm: mmap: zap pages with read mmap_sem in munmap")
> Cc: stable@vger.kernel.org
> Cc: Liam Howlett <liam.howlett@oracle.com>
> Cc: Minchan Kim <minchan@kernel.org>
> Signed-off-by: Carlos Llamas <cmllamas@google.com>
This change makes sense to me, and I agree that the code still needs to
run when the vma is null.
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 05/21] binder: fix trivial typo of binder_free_buf_locked()
[not found] <20231102185934.773885-1-cmllamas@google.com>
2023-11-02 18:59 ` [PATCH 01/21] binder: use EPOLLERR from eventpoll.h Carlos Llamas
2023-11-02 18:59 ` [PATCH 02/21] binder: fix use-after-free in shinker's callback Carlos Llamas
@ 2023-11-02 18:59 ` Carlos Llamas
2023-11-07 9:08 ` Alice Ryhl
2023-11-02 18:59 ` [PATCH 06/21] binder: fix comment on binder_alloc_new_buf() return value Carlos Llamas
3 siblings, 1 reply; 12+ messages in thread
From: Carlos Llamas @ 2023-11-02 18:59 UTC (permalink / raw)
To: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
Suren Baghdasaryan
Cc: linux-kernel, kernel-team, stable, Todd Kjos
Fix minor misspelling of the function in the comment section.
No functional changes in this patch.
Cc: stable@vger.kernel.org
Fixes: 0f966cba95c7 ("binder: add flag to clear buffer on txn complete")
Signed-off-by: Carlos Llamas <cmllamas@google.com>
---
drivers/android/binder_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c
index 9b28d0f9666d..cd720bb5c9ce 100644
--- a/drivers/android/binder_alloc.c
+++ b/drivers/android/binder_alloc.c
@@ -707,7 +707,7 @@ void binder_alloc_free_buf(struct binder_alloc *alloc,
/*
* We could eliminate the call to binder_alloc_clear_buf()
* from binder_alloc_deferred_release() by moving this to
- * binder_alloc_free_buf_locked(). However, that could
+ * binder_free_buf_locked(). However, that could
* increase contention for the alloc mutex if clear_on_free
* is used frequently for large buffers. The mutex is not
* needed for correctness here.
--
2.42.0.869.gea05f2083d-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 05/21] binder: fix trivial typo of binder_free_buf_locked()
2023-11-02 18:59 ` [PATCH 05/21] binder: fix trivial typo of binder_free_buf_locked() Carlos Llamas
@ 2023-11-07 9:08 ` Alice Ryhl
2023-12-01 6:52 ` Carlos Llamas
0 siblings, 1 reply; 12+ messages in thread
From: Alice Ryhl @ 2023-11-07 9:08 UTC (permalink / raw)
To: Carlos Llamas
Cc: Arve Hjønnevåg, Christian Brauner, Greg Kroah-Hartman,
Joel Fernandes, Martijn Coenen, Suren Baghdasaryan, Todd Kjos,
Todd Kjos, kernel-team, linux-kernel, stable
Carlos Llamas <cmllamas@google.com> writes:
> Fix minor misspelling of the function in the comment section.
>
> No functional changes in this patch.
>
> Cc: stable@vger.kernel.org
> Fixes: 0f966cba95c7 ("binder: add flag to clear buffer on txn complete")
> Signed-off-by: Carlos Llamas <cmllamas@google.com>
It's a bit confusing that the pair of methods binder_alloc_free_buf and
binder_free_buf_locked are inconsistent in whether they user the alloc_
prefix. It might be worth it to change them to be consistent?
Either way, this change LGTM.
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH 05/21] binder: fix trivial typo of binder_free_buf_locked()
2023-11-07 9:08 ` Alice Ryhl
@ 2023-12-01 6:52 ` Carlos Llamas
0 siblings, 0 replies; 12+ messages in thread
From: Carlos Llamas @ 2023-12-01 6:52 UTC (permalink / raw)
To: Alice Ryhl
Cc: Arve Hjønnevåg, Christian Brauner, Greg Kroah-Hartman,
Joel Fernandes, Martijn Coenen, Suren Baghdasaryan, Todd Kjos,
Todd Kjos, kernel-team, linux-kernel, stable
On Tue, Nov 07, 2023 at 09:08:05AM +0000, Alice Ryhl wrote:
> It's a bit confusing that the pair of methods binder_alloc_free_buf and
> binder_free_buf_locked are inconsistent in whether they user the alloc_
> prefix. It might be worth it to change them to be consistent?
Right, the prefix is concistent across the APIs but not really for the
local function names. I wouldn't mind adding the "alloc" part, it just
seemed easier to fix the comment and backport that.
--
Carlos Llamas
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 06/21] binder: fix comment on binder_alloc_new_buf() return value
[not found] <20231102185934.773885-1-cmllamas@google.com>
` (2 preceding siblings ...)
2023-11-02 18:59 ` [PATCH 05/21] binder: fix trivial typo of binder_free_buf_locked() Carlos Llamas
@ 2023-11-02 18:59 ` Carlos Llamas
2023-11-07 9:08 ` Alice Ryhl
3 siblings, 1 reply; 12+ messages in thread
From: Carlos Llamas @ 2023-11-02 18:59 UTC (permalink / raw)
To: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
Suren Baghdasaryan
Cc: linux-kernel, kernel-team, stable
Update the comments of binder_alloc_new_buf() to reflect that the return
value of the function is now ERR_PTR(-errno) on failure.
No functional changes in this patch.
Cc: stable@vger.kernel.org
Fixes: 57ada2fb2250 ("binder: add log information for binder transaction failures")
Signed-off-by: Carlos Llamas <cmllamas@google.com>
---
drivers/android/binder_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c
index cd720bb5c9ce..0e8312f4b771 100644
--- a/drivers/android/binder_alloc.c
+++ b/drivers/android/binder_alloc.c
@@ -558,7 +558,7 @@ static struct binder_buffer *binder_alloc_new_buf_locked(
* is the sum of the three given sizes (each rounded up to
* pointer-sized boundary)
*
- * Return: The allocated buffer or %NULL if error
+ * Return: The allocated buffer or %ERR_PTR(-errno) if error
*/
struct binder_buffer *binder_alloc_new_buf(struct binder_alloc *alloc,
size_t data_size,
--
2.42.0.869.gea05f2083d-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 06/21] binder: fix comment on binder_alloc_new_buf() return value
2023-11-02 18:59 ` [PATCH 06/21] binder: fix comment on binder_alloc_new_buf() return value Carlos Llamas
@ 2023-11-07 9:08 ` Alice Ryhl
0 siblings, 0 replies; 12+ messages in thread
From: Alice Ryhl @ 2023-11-07 9:08 UTC (permalink / raw)
To: Carlos Llamas
Cc: Arve Hjønnevåg, Christian Brauner, Greg Kroah-Hartman,
Joel Fernandes, kernel-team, linux-kernel, Martijn Coenen, stable,
Suren Baghdasaryan, Todd Kjos
Carlos Llamas <cmllamas@google.com> writes:
> Update the comments of binder_alloc_new_buf() to reflect that the return
> value of the function is now ERR_PTR(-errno) on failure.
>
> No functional changes in this patch.
>
> Cc: stable@vger.kernel.org
> Fixes: 57ada2fb2250 ("binder: add log information for binder transaction failures")
> Signed-off-by: Carlos Llamas <cmllamas@google.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply [flat|nested] 12+ messages in thread