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)
committerAurelien Jarno <aurel32@debian.org>
Fri, 2 Mar 2018 07:52:22 +0000 (07:52 +0000)
commit29b6b3d2edf0c05149186a308c57eb8fa2184b38
treef34d0f9c611ebba7d71d1b44d8ab8856f738acee
parentf8f073c23e3bb3d4b43b17fbf26d50701fdcc45b
mm/mmap.c: expand_downwards: don't require the gap if !vm_prev

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>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name mm-mmap.c-expand_downwards-don-t-require-the-gap-if-.patch
mm/mmap.c