Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mm/mlock: fix vma iterator conversion of apply_vma_lock_flags()
apply_vma_lock_flags() calls mlock_fixup(), which could merge the VMA after where the vma iterator is located. Although this is not an issue, the next iteration of the loop will check the start of the vma to be equal to the locally saved 'tmp' variable and cause an incorrect failure scenario. Fix the error by setting tmp to the end of the vma iterator value before restarting the loop. There is also a potential of the error code being overwritten when the loop terminates early. Fix the return issue by directly returning when an error is encountered since there is nothing to undo after the loop. Link: https://lkml.kernel.org/r/[email protected] Fixes: 37598f5 ("mlock: convert mlock to vma iterator") Signed-off-by: Liam R. Howlett <[email protected]> Reported-by: Ryan Roberts <[email protected]> Link: https://lore.kernel.org/linux-mm/[email protected]/ Tested-by: Ryan Roberts <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
- Loading branch information