[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230906103312.645712-1-xiujianfeng@huaweicloud.com>
Date: Wed, 6 Sep 2023 10:33:12 +0000
From: Xiu Jianfeng <xiujianfeng@...weicloud.com>
To: akpm@...ux-foundation.org, Liam.Howlett@...cle.com,
willy@...radead.org
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
xiujianfeng@...wei.com
Subject: [PATCH] mm: remove duplicated vma->vm_flags check when expanding stack
From: Xiu Jianfeng <xiujianfeng@...wei.com>
expand_upwards() and expand_downwards() will return -EFAULT if VM_GROWSUP
or VM_GROWSDOWN is not correctly set in vma->vm_flags, however in
!CONFIG_STACK_GROWSUP case, expand_stack_locked() returns -EINVAL first
if !(vma->vm_flags & VM_GROWSDOWN) before calling expand_downwards(), to
keep the consistency with CONFIG_STACK_GROWSUP case, remove this check.
Fixes: f440fa1ac955 ("mm: make find_extend_vma() fail if write lock not held")
Signed-off-by: Xiu Jianfeng <xiujianfeng@...wei.com>
---
mm/mmap.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/mm/mmap.c b/mm/mmap.c
index b56a7f0c9f85..ed4848db7515 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2159,8 +2159,6 @@ struct vm_area_struct *find_extend_vma_locked(struct mm_struct *mm, unsigned lon
#else
int expand_stack_locked(struct vm_area_struct *vma, unsigned long address)
{
- if (unlikely(!(vma->vm_flags & VM_GROWSDOWN)))
- return -EINVAL;
return expand_downwards(vma, address);
}
--
2.34.1
Powered by blists - more mailing lists