FROMLIST: binder: use atomic for transaction_log index
authorTodd Kjos <tkjos@google.com>
Wed, 24 May 2017 20:33:28 +0000 (13:33 -0700)
committerTodd Kjos <tkjos@google.com>
Thu, 13 Jul 2017 15:34:20 +0000 (08:34 -0700)
commit1cfe62771e5dc690ca4b6da81864babc19c48967
treea60bcd265a84d3aa6750b3af0c421ff5334b2890
parent970df8bb4e72d0337cda34d19df25b729eaf51e3
FROMLIST: binder: use atomic for transaction_log index

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

The log->next index for the transaction log was
not protected when incremented. This led to a
case where log->next++ resulted in an index
larger than ARRAY_SIZE(log->entry) and eventually
a bad access to memory.

Fixed by making the log index an atomic64 and
converting to an array by using "% ARRAY_SIZE(log->entry)"

Also added "complete" field to the log entry which is
written last to tell the print code whether the
entry is complete

Change-Id: I539f285fee3406468e7f89de3cd560285bfd9ab1
Signed-off-by: Todd Kjos <tkjos@google.com>
drivers/android/binder.c