]> 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>
Mon, 28 Nov 2022 20:18:34 +0000 (15:18 -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 03e383d5982ac81fa07e777bc2b194d57740d21c..d3f601c6d49a33c320f75007e28758b1a7322d9e 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);