]> git.itanic.dy.fi Git - linux-stable/commit
binder: add lockless binder_alloc_(set|get)_vma()
authorCarlos Llamas <cmllamas@google.com>
Tue, 2 May 2023 20:12:19 +0000 (20:12 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 May 2023 13:17:23 +0000 (14:17 +0100)
commit1c17c3fef33e7dee6774eda1d8201b40f98614b1
tree4384310a8756e16af80482055da8c90035a71702
parentfd4d4cb497f831c788bdc8c041bb64bc4d3121aa
binder: add lockless binder_alloc_(set|get)_vma()

commit 0fa53349c3acba0239369ba4cd133740a408d246 upstream.

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: a43cfc87caaf ("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: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20230502201220.1756319-3-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/android/binder_alloc.c