On Thu, Dec 03, 2020 at 04:53:50PM +0800, Liu Zixian wrote:
On success, mmap should return the begin address of newly mapped area, but patch "mm: mmap: merge vma after call_mmap() if possible" set vm_start of newly merged vma to return value addr. Users of mmap will get wrong address if vma is merged after call_mmap(). We fix this by moving the assignment to addr before merging vma.
Fixes: d70cec898324 ("mm: mmap: merge vma after call_mmap() if possible") Signed-off-by: Liu Zixian liuzixian4@huawei.com
v2: We want to do "addr = vma->vm_start;" unconditionally, so move assignment to addr before if(unlikely) block.
mm/mmap.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
Reviewed-by: Jason Gunthorpe jgg@nvidia.com
Jason