linux/drivers/staging/android
Shawn Lin 512e9d6827 staging: ion: fix corruption of ion_import_dma_buf
commit 6fa92e2bcf upstream.

we found this issue but still exit in lastest kernel. Simply
keep ion_handle_create under mutex_lock to avoid this race.

WARNING: CPU: 2 PID: 2648 at drivers/staging/android/ion/ion.c:512 ion_handle_add+0xb4/0xc0()
ion_handle_add: buffer already found.
Modules linked in: iwlmvm iwlwifi mac80211 cfg80211 compat
CPU: 2 PID: 2648 Comm: TimedEventQueue Tainted: G        W    3.14.0 #7
 00000000 00000000 9a3efd2c 80faf273 9a3efd6c 9a3efd5c 80935dc9 811d7fd3
 9a3efd88 00000a58 812208a0 00000200 80e128d4 80e128d4 8d4ae00c a8cd8600
 a8cd8094 9a3efd74 80935e0e 00000009 9a3efd6c 811d7fd3 9a3efd88 9a3efd9c
Call Trace:
  [<80faf273>] dump_stack+0x48/0x69
  [<80935dc9>] warn_slowpath_common+0x79/0x90
  [<80e128d4>] ? ion_handle_add+0xb4/0xc0
  [<80e128d4>] ? ion_handle_add+0xb4/0xc0
  [<80935e0e>] warn_slowpath_fmt+0x2e/0x30
  [<80e128d4>] ion_handle_add+0xb4/0xc0
  [<80e144cc>] ion_import_dma_buf+0x8c/0x110
  [<80c517c4>] reg_init+0x364/0x7d0
  [<80993363>] ? futex_wait+0x123/0x210
  [<80992e0e>] ? get_futex_key+0x16e/0x1e0
  [<8099308f>] ? futex_wake+0x5f/0x120
  [<80c51e19>] vpu_service_ioctl+0x1e9/0x500
  [<80994aec>] ? do_futex+0xec/0x8e0
  [<80971080>] ? prepare_to_wait_event+0xc0/0xc0
  [<80c51c30>] ? reg_init+0x7d0/0x7d0
  [<80a22562>] do_vfs_ioctl+0x2d2/0x4c0
  [<80b198ad>] ? inode_has_perm.isra.41+0x2d/0x40
  [<80b199cf>] ? file_has_perm+0x7f/0x90
  [<80b1a5f7>] ? selinux_file_ioctl+0x47/0xf0
  [<80a227a8>] SyS_ioctl+0x58/0x80
  [<80fb45e8>] syscall_call+0x7/0x7
  [<80fb0000>] ? mmc_do_calc_max_discard+0xab/0xe4

Fixes: 83271f626 ("ion: hold reference to handle...")
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
History 2015-10-09 14:41:06 +01:00
..
ion staging: ion: fix corruption of ion_import_dma_buf 2015-10-09 14:41:06 +01:00
trace staging: sync: Add tracepoint support 2013-03-04 17:46:55 +08:00
uapi staging: android: uapi: fix coding style 2014-04-16 20:17:31 -07:00
alarm-dev.c staging: android: fix missing a blank line after declarations 2014-05-03 19:46:30 -04:00
android_alarm.h staging: android: Split uapi out of android_alarm.h 2014-02-18 11:03:28 -08:00
ashmem.c staging: ashmem: Avoid deadlock between read and mmap calls 2014-02-07 09:03:16 -08:00
ashmem.h staging: android: Split uapi out of ashmem.h 2014-02-18 11:03:28 -08:00
binder.c Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next 2014-06-03 14:00:15 -07:00
binder.h staging: binder: Support concurrent 32 bit and 64 bit processes. 2014-02-24 16:29:40 -08:00
binder_trace.h staging: binder: Support concurrent 32 bit and 64 bit processes. 2014-02-24 16:29:40 -08:00
Kconfig Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-04-02 16:23:38 -07:00
logger.c staging: android: fix missing a blank line after declarations 2014-05-03 19:46:30 -04:00
logger.h staging: android: logger: use kuid_t instead of uid_t 2013-05-16 15:37:51 -07:00
lowmemorykiller.c staging: android: lowmemorykiller: neglect swap cached pages in other_file 2014-02-27 14:51:27 -08:00
Makefile ion: Reenable the build 2013-12-15 09:40:11 -08:00
sw_sync.c staging: android: fix missing a blank line after declarations 2014-05-03 19:46:30 -04:00
sw_sync.h staging: android: split uapi out of sync.h and sw_sync.h 2014-02-18 11:03:28 -08:00
sync.c staging: android: describe use of memory barrier on sync.c 2014-05-25 11:09:14 -07:00
sync.h staging: android: split uapi out of sync.h and sw_sync.h 2014-02-18 11:03:28 -08:00
timed_gpio.c staging : android: Fixes a coding style issue in timed_gpio.c 2014-05-24 01:54:55 +09:00
timed_gpio.h Staging: android: timed_gpio: Removed spaces before tabs 2012-02-29 15:52:52 -08:00
timed_output.c staging: android: timed_output: fix use after free of dev 2014-06-19 17:33:37 -07:00
timed_output.h staging: android: timed_output: fix a checkpatch warning 2014-02-11 12:27:30 -08:00
TODO drivers:staging:android Typos: fix some comments that have typos in them. 2012-02-08 16:47:50 -08:00