summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2013-09-11 14:20:18 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-11 15:57:05 -0700
commitb2c56e4f7d93be3f33a82ec66f0d0f46713ff5f1 (patch)
tree17dad390dd4f45738ff0d676862b3434b496b72e /arch
parent465c47fd8dc44302fed6c4eab8927464744ce08c (diff)
downloadop-kernel-dev-b2c56e4f7d93be3f33a82ec66f0d0f46713ff5f1.zip
op-kernel-dev-b2c56e4f7d93be3f33a82ec66f0d0f46713ff5f1.tar.gz
mm: shift VM_GROWS* check from mmap_region() to do_mmap_pgoff()
mmap() doesn't allow the non-anonymous mappings with VM_GROWS* bit set. In particular this means that mmap_region()->vma_merge(file, vm_flags) must always fail if "vm_flags & VM_GROWS" is set incorrectly. So it does not make sense to check VM_GROWS* after we already allocated the new vma, the only caller, do_mmap_pgoff(), which can pass this flag can do the check itself. And this looks a bit more correct, mmap_region() already unmapped the old mapping at this stage. But if mmap() is going to fail, it should avoid do_munmap() if possible. Note: we check VM_GROWS at the end to ensure that do_mmap_pgoff() won't return EINVAL in the case when it currently returns another error code. Many thanks to Hugh who nacked the buggy v1. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Hugh Dickins <hughd@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud