Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ipc/shm: fix crash if CONFIG_SHMEM is not set
Commit c01d5b3 ("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: c01d5b3 ("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]>
- Loading branch information