diff options
author | Kirill A. Shutemov <[email protected]> | 2016-09-19 14:44:18 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2016-09-19 15:36:17 -0700 |
commit | 31b4beb473e3bdee1bf79db849502dcb24b5c202 (patch) | |
tree | ba862e325b07ebd106cde077dfbddd3aedf4b233 /lib/mpi/mpiutil.c | |
parent | c8de641b1e9c5489aa6ca57b7836acd68e7563f1 (diff) |
ipc/shm: fix crash if CONFIG_SHMEM is not set
Commit c01d5b300774 ("shmem: get_unmapped_area align huge page") makes
use of shm_get_unmapped_area() in shm_file_operations() unconditional to
CONFIG_MMU.
As Tony Battersby pointed this can lead NULL-pointer dereference on
machine with CONFIG_MMU=y and CONFIG_SHMEM=n. In this case ipc/shm is
backed by ramfs which doesn't provide f_op->get_unmapped_area for
configurations with MMU.
The solution is to provide dummy f_op->get_unmapped_area for ramfs when
CONFIG_MMU=y, which just call current->mm->get_unmapped_area().
Fixes: c01d5b300774 ("shmem: get_unmapped_area align huge page")
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Kirill A. Shutemov <[email protected]>
Reported-by: Tony Battersby <[email protected]>
Tested-by: Tony Battersby <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: <[email protected]> [4.7.x]
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/mpi/mpiutil.c')
0 files changed, 0 insertions, 0 deletions