Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

maple_tree: remove rcu_read_lock() from mt_validate()

The write lock should be held when validating the tree to avoid updates
racing with checks. Holding the rcu read lock during a large tree
validation may also cause a prolonged rcu read window and "rcu_preempt
detected stalls" warnings.

Link: https://lore.kernel.org/all/0000000000001d12d4062005aea1@google.com/
Link: https://lkml.kernel.org/r/20240820175417.2782532-1-Liam.Howlett@oracle.com
Fixes: 54a611b60590 ("Maple Tree: add new data structure")
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Reported-by: syzbot+036af2f0c7338a33b0cd@syzkaller.appspotmail.com
Cc: Hillf Danton <hdanton@sina.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Liam R. Howlett and committed by
Andrew Morton
f806de88 6dacd79d

+2 -5
+2 -5
lib/maple_tree.c
··· 7566 7566 * 2. The gap is correctly set in the parents 7567 7567 */ 7568 7568 void mt_validate(struct maple_tree *mt) 7569 + __must_hold(mas->tree->ma_lock) 7569 7570 { 7570 7571 unsigned char end; 7571 7572 7572 7573 MA_STATE(mas, mt, 0, 0); 7573 - rcu_read_lock(); 7574 7574 mas_start(&mas); 7575 7575 if (!mas_is_active(&mas)) 7576 - goto done; 7576 + return; 7577 7577 7578 7578 while (!mte_is_leaf(mas.node)) 7579 7579 mas_descend(&mas); ··· 7594 7594 mas_dfs_postorder(&mas, ULONG_MAX); 7595 7595 } 7596 7596 mt_validate_nulls(mt); 7597 - done: 7598 - rcu_read_unlock(); 7599 - 7600 7597 } 7601 7598 EXPORT_SYMBOL_GPL(mt_validate); 7602 7599