]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mm/mmap.c: expand_downwards: don't require the gap if !vm_prev
authorOleg Nesterov <oleg@redhat.com>
Mon, 10 Jul 2017 22:49:54 +0000 (15:49 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 2 May 2019 20:42:01 +0000 (21:42 +0100)
commit120d66394f05ec50a018168850a8db6518ea2d9b
tree753bf289726863b05f2f683f9b18bbb581ca4d13
parent2c716db6f80cef6159972be0dab86892c39de277
mm/mmap.c: expand_downwards: don't require the gap if !vm_prev

commit 32e4e6d5cbb0c0e427391635991fe65e17797af8 upstream.

expand_stack(vma) fails if address < stack_guard_gap even if there is no
vma->vm_prev.  I don't think this makes sense, and we didn't do this
before the recent commit 1be7107fbe18 ("mm: larger stack guard gap,
between vmas").

We do not need a gap in this case, any address is fine as long as
security_mmap_addr() doesn't object.

This also simplifies the code, we know that address >= prev->vm_end and
thus underflow is not possible.

Link: http://lkml.kernel.org/r/20170628175258.GA24881@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Larry Woodman <lwoodman@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
mm/mmap.c