]> git.ipfire.org Git - thirdparty/linux.git/commit - mm/mmap.c
mm/mmap/vma_merge: always check invariants
authorLorenzo Stoakes <lstoakes@gmail.com>
Sun, 30 Apr 2023 20:19:17 +0000 (21:19 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 6 May 2023 17:10:07 +0000 (10:10 -0700)
commit29417d292bd0fa174d20360326abaf6444a23c3b
treec7884e59b24dd1d199d58646f7c27bcce90f5562
parent418d5c98319f67b9ae651babea031b5394425c18
mm/mmap/vma_merge: always check invariants

We may still have inconsistent input parameters even if we choose not to
merge and the vma_merge() invariant checks are useful for checking this
with no production runtime cost (these are only relevant when
CONFIG_DEBUG_VM is specified).

Therefore, perform these checks regardless of whether we merge.

This is relevant, as a recent issue (addressed in commit "mm/mempolicy:
Correctly update prev when policy is equal on mbind") in the mbind logic
was only picked up in the 6.2.y stable branch where these assertions are
performed prior to determining mergeability.

Had this remained the same in mainline this issue may have been picked up
faster, so moving forward let's always check them.

Link: https://lkml.kernel.org/r/df548a6ae3fa135eec3b446eb3dae8eb4227da97.1682885809.git.lstoakes@gmail.com
Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mmap.c