]> www.infradead.org Git - users/jedix/linux-maple.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>
Mon, 18 Aug 2025 05:08:19 +0000 (22:08 -0700)
commit148b08e3121ecdff87c46c08bde7eabf43111822
tree06796daf86f8af95c94136d12be61f18ac567406
parented4b47f274c469f64174dd8d8e600174d45dddd2
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