Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f65360b authored by Charan Teja Reddy's avatar Charan Teja Reddy Committed by Srinivasarao P
Browse files

mm/madvise: use mmap_sem lock from passed mm_struct

Use the mmap_sem lock from passed 'mm' rather than the 'current' as it
is required because of the patchset[1]. The commit f4fa8d93 ("mm:
madvise: fix vma user-after-free") changed the 'mmap_sem' to use from
'current' instead of 'mm' context. Revert it.

Link: [1] https://patchwork.kernel.org/project/linux-mm/patch/20200302193630.68771-2-minchan@kernel.org/

.

Change-Id: Ifc9deb2a5f0775c2bc97c85db3584f61fa3a43ae
Signed-off-by: default avatarCharan Teja Reddy <charante@codeaurora.org>
Signed-off-by: default avatarSrinivasarao P <spathi@codeaurora.org>
parent 9bf32d70
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -298,7 +298,7 @@ static long madvise_willneed(struct vm_area_struct *vma,
	get_file(file);
	offset = (loff_t)(start - vma->vm_start)
			+ ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
	up_read(&current->mm->mmap_sem);
	up_read(&mm->mmap_sem);
	vfs_fadvise(file, offset, end - start, POSIX_FADV_WILLNEED);
	fput(file);
	down_read(&mm->mmap_sem);