]> git.baikalelectronics.ru Git - kernel.git/commit
binder: fix potential UAF of target_{proc,thread}
authorCarlos Llamas <cmllamas@google.com>
Tue, 17 May 2022 18:58:17 +0000 (18:58 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 May 2022 16:41:26 +0000 (18:41 +0200)
commit8a275f212871e17f1d3742a4d40db7841c645c61
treee858cd584328605834333c3d898e6d8971119720
parent2a534a3124000f4489824efacb306f1c3a3d8247
binder: fix potential UAF of target_{proc,thread}

Commit f066a49a5d92 ("binder: add failed transaction logging info")
dereferences target_{proc,thread} after they have been potentially
freed by binder_proc_dec_tmpref() and binder_thread_dec_tmpref().

This patch delays the release of the two references after their last
usage. Fixes the following two errors reported by smatch:

  drivers/android/binder.c:3562 binder_transaction() error: dereferencing freed memory 'target_proc'
  drivers/android/binder.c:3563 binder_transaction() error: dereferencing freed memory 'target_thread'

Fixes: f066a49a5d92 ("binder: add failed transaction logging info")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Todd Kjos <tkjos@google.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20220517185817.598872-1-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/android/binder.c