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>
Thu, 1 Sep 2022 21:35:27 +0000 (17:35 -0400)
If RCU is enabled and the tree changes, 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 5e7d01e7e5ba2a7980944fec1a7bcc2f73f796be..e668f553a21729ce168a784d52b51886156f584a 100644 (file)
@@ -610,7 +610,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);
@@ -629,7 +629,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);