Staging: android: binder: Fix crashes when sharing a binder file between processes
authorArve Hjønnevåg <arve@android.com>
Wed, 1 Feb 2012 23:29:13 +0000 (15:29 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Feb 2012 22:14:13 +0000 (14:14 -0800)
commitbd1eff9741af27378b241b347041c724bb28e857
tree47ec1db37ae76c3b8b4b2908cc6a5129191b5089
parentb0d017e80e9f4e6b37e699b9a944646e64deb473
Staging: android: binder: Fix crashes when sharing a binder file between processes

Opening the binder driver and sharing the file returned with
other processes (e.g. by calling fork) can crash the kernel.
Prevent these crashes with the following changes:
- Add a mutex to protect against two processes mmapping the
  same binder_proc.
- After locking mmap_sem, check that the vma we want to access
  (still) points to the same mm_struct.
- Use proc->tsk instead of current to get the files struct since
  this is where we get the rlimit from.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/binder.c