FROMLIST: binder: protect against stale pointers in print_binder_transaction
authorTodd Kjos <tkjos@google.com>
Fri, 21 Apr 2017 21:32:11 +0000 (14:32 -0700)
committerDanny Wood <danwood76@gmail.com>
Tue, 26 Feb 2019 11:36:35 +0000 (11:36 +0000)
commitc2bdc4c41b82eb683702d7d03636cc9cc8398634
treeee38aa3847484e21102205990a0134a4cb21e0fb
parent5717118f4d1c2a4ceebea9148712d80f05b2a644
FROMLIST: binder: protect against stale pointers in print_binder_transaction

(from https://patchwork.kernel.org/patch/9817761/)

When printing transactions there were several race conditions
that could cause a stale pointer to be deferenced. Fixed by
reading the pointer once and using it if valid (which is
safe). The transaction buffer also needed protection via proc
lock, so it is only printed if we are holding the correct lock.

Bug: 36650912
Test: tested manually
Change-Id: I78240f99cc1a070d70a841c0d84d4306e2fd528d
Signed-off-by: Todd Kjos <tkjos@google.com>
drivers/android/binder.c