]> git.ipfire.org Git - thirdparty/linux.git/commit
mm: change vma_start_read() to drop RCU lock on failure
authorSuren Baghdasaryan <surenb@google.com>
Mon, 4 Aug 2025 23:33:49 +0000 (16:33 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 13 Sep 2025 23:54:43 +0000 (16:54 -0700)
commit0b16f8bed19c6af82233cb57d01cfc944cce8fb7
tree914aa388ba838a9f41f8db6b6630c13e5e59986f
parentcc483b328881bbccb55265a86731384d5176fe85
mm: change vma_start_read() to drop RCU lock on failure

vma_start_read() can drop and reacquire RCU lock in certain failure cases.
It's not apparent that the RCU session started by the caller of this
function might be interrupted when vma_start_read() fails to lock the vma.
This might become a source of subtle bugs and to prevent that we change
the locking rules for vma_start_read() to drop RCU read lock upon failure.
This way it's more obvious that RCU-protected objects are unsafe after
vma locking fails.

Link: https://lkml.kernel.org/r/20250804233349.1278678-2-surenb@google.com
Suggested-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Tested-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Jann Horn <jannh@google.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mmap_lock.c