Commit 50745c47 authored by Carlos Llamas's avatar Carlos Llamas Committed by feng xiao
Browse files

BACKPORT: FROMGIT: binder: add lockless binder_alloc_(set|get)_vma()



Bring back the original lockless design in binder_alloc to determine
whether the buffer setup has been completed by the ->mmap() handler.
However, this time use smp_load_acquire() and smp_store_release() to
wrap all the ordering in a single macro call.

Also, add comments to make it evident that binder uses alloc->vma to
determine when the binder_alloc has been fully initialized. In these
scenarios acquiring the mmap_lock is not required.

Fixes: a43cfc87 ("android: binder: stop saving a pointer to the VMA")
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarCarlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20230502201220.1756319-3-cmllamas@google.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 284244471
Bug: 284081259
Bug: 274561072
(cherry picked from commit 0fa53349
 git: //git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
 char-misc-linus)
[cmllamas: resolved conflicts with missing commit d6d04d71]
Change-Id: I208daff07036a2a962f0fd45f30ec88df7e63d55
Signed-off-by: default avatarCarlos Llamas <cmllamas@google.com>
parent 4feb5491
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment