OpenCloudOS-Kernel/drivers/staging/android
Yisheng Xie 740a5759bf staging: android: ashmem: Fix possible deadlock in ashmem_ioctl
ashmem_mutex may create a chain of dependencies like:

CPU0                                    CPU1
 mmap syscall                           ioctl syscall
 -> mmap_sem (acquired)                 -> ashmem_ioctl
 -> ashmem_mmap                            -> ashmem_mutex (acquired)
    -> ashmem_mutex (try to acquire)       -> copy_from_user
                                              -> mmap_sem (try to acquire)

There is a lock odering problem between mmap_sem and ashmem_mutex causing
a lockdep splat[1] during a syzcaller test. This patch fixes the problem
by move copy_from_user out of ashmem_mutex.

[1] https://www.spinics.net/lists/kernel/msg2733200.html

Fixes: ce8a3a9e76 (staging: android: ashmem: Fix a race condition in pin ioctls)
Reported-by: syzbot+d7a918a7a8e1c952bc36@syzkaller.appspotmail.com
Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 07:21:10 -08:00
..
ion staging: android: ion: Zero CMA allocated memory 2018-02-16 17:50:09 +01:00
uapi staging: android: Remove redundant license text 2017-11-28 13:20:48 +01:00
Kconfig staging, android: remove lowmemory killer from the tree 2017-03-09 13:47:03 +01:00
Makefile staging, android: remove lowmemory killer from the tree 2017-03-09 13:47:03 +01:00
TODO staging: android: TODO: Removing an invalid issue 2017-10-03 18:36:57 +02:00
ashmem.c staging: android: ashmem: Fix possible deadlock in ashmem_ioctl 2018-03-06 07:21:10 -08:00
ashmem.h staging: android: add SPDX identifiers to all android driver files 2017-11-28 13:20:47 +01:00