]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Change RCU checks to WARN_ON() instead of BUG_ON()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 1 Sep 2022 21:33:43 +0000 (17:33 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 13 Dec 2022 21:22:36 +0000 (16:22 -0500)
If RCU is enabled and the tree isn't locked, just warn the user and
avoid crashing the kernel.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
include/linux/maple_tree.h

index 71de6ef474e4c06361babc2a062783c471b8b26d..ff6f2e1f1355c8160df2c9b139a1bd061486e21e 100644 (file)
@@ -621,7 +621,7 @@ static inline void mt_clear_in_rcu(struct maple_tree *mt)
                return;
 
        if (mt_external_lock(mt)) {
-               BUG_ON(!mt_lock_is_held(mt));
+               WARN_ON(!mt_lock_is_held(mt));
                mt->ma_flags &= ~MT_FLAGS_USE_RCU;
        } else {
                mtree_lock(mt);
@@ -640,7 +640,7 @@ static inline void mt_set_in_rcu(struct maple_tree *mt)
                return;
 
        if (mt_external_lock(mt)) {
-               BUG_ON(!mt_lock_is_held(mt));
+               WARN_ON(!mt_lock_is_held(mt));
                mt->ma_flags |= MT_FLAGS_USE_RCU;
        } else {
                mtree_lock(mt);