binder: use atomic for transaction_log index
authorTodd Kjos <tkjos@android.com>
Thu, 29 Jun 2017 19:01:53 +0000 (12:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Jul 2017 12:47:30 +0000 (14:47 +0200)
commitd99c7333ab1c9d56e6f6e15c0b4398591465efc1
tree6b0029f5e7a52579c60916fabd9f5301819d63e9
parentb05a68e94b97eae2ae671ed703416f8dd21e4257
binder: use atomic for transaction_log index

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

Signed-off-by: Todd Kjos <tkjos@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/android/binder.c