]> Git Repo - linux.git/commit
mm/mlock: set the correct prev on failure
authorWei Yang <[email protected]>
Sun, 27 Oct 2024 12:33:21 +0000 (12:33 +0000)
committerAndrew Morton <[email protected]>
Thu, 7 Nov 2024 22:14:58 +0000 (14:14 -0800)
commitfaa242b1d2a97143150bdc50d5b61fd70fcd17cd
tree17b9cec9ab37f16dffd7e389e4ece081fa9202ee
parentcb6fcef8b4b6c655b6a25cc3a415cd9eb81b3da8
mm/mlock: set the correct prev on failure

After commit 94d7d9233951 ("mm: abstract the vma_merge()/split_vma()
pattern for mprotect() et al."), if vma_modify_flags() return error, the
vma is set to an error code.  This will lead to an invalid prev be
returned.

Generally this shouldn't matter as the caller should treat an error as
indicating state is now invalidated, however unfortunately
apply_mlockall_flags() does not check for errors and assumes that
mlock_fixup() correctly maintains prev even if an error were to occur.

This patch fixes that assumption.

[[email protected]: provide a better fix and rephrase the log]
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 94d7d9233951 ("mm: abstract the vma_merge()/split_vma() pattern for mprotect() et al.")
Signed-off-by: Wei Yang <[email protected]>
Reviewed-by: Lorenzo Stoakes <[email protected]>
Reviewed-by: Liam R. Howlett <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Jann Horn <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
mm/mlock.c
This page took 0.050966 seconds and 4 git commands to generate.