Signed-off-by: Yu-cheng Yu <yu-cheng.yu@xxxxxxxxx> --- mm/mremap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/mremap.c b/mm/mremap.c index 049470aa1e3e..70f20edb248e 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -525,7 +525,7 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len, unsigned long, new_addr) { struct mm_struct *mm = current->mm; - struct vm_area_struct *vma; + struct vm_area_struct *vma = find_vma(mm, addr); unsigned long ret = -EINVAL; unsigned long charged = 0; bool locked = false; @@ -533,6 +533,9 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len, LIST_HEAD(uf_unmap_early); LIST_HEAD(uf_unmap); + if (vma->vm_flags & VM_SHSTK) + return ret; + if (flags & ~(MREMAP_FIXED | MREMAP_MAYMOVE)) return ret; -- 2.15.1