]> 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>
Wed, 29 Mar 2023 22:58:38 +0000 (18:58 -0400)
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 11d80c2dbbf7820334becf899179ef86cc503d5f..1dc0ded12ff7622681cbca3c63308819dd3b8fa2 100644 (file)
@@ -616,7 +616,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);
@@ -635,7 +635,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);