pool: avoid BUG_ON()
authorDavid Herrmann <dh.herrmann@gmail.com>
Wed, 17 Dec 2014 11:17:29 +0000 (12:17 +0100)
committerDavid Herrmann <dh.herrmann@gmail.com>
Wed, 17 Dec 2014 11:17:29 +0000 (12:17 +0100)
If you deref a NULL pointer, you trigger a WARN. It seems highly
excessive to trigger a panic (BUG) if we leak a child slice. So turn the
BUG into a WARN and add one more to be consistent with
kdbus_pool_slice_release().

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
pool.c

diff --git a/pool.c b/pool.c
index 4ff19c44e9bbb12b958823e44780ebf6b72c8ea5..2ef6ac73656746c405970fa34be2bed7c0fcde31 100644 (file)
--- a/pool.c
+++ b/pool.c
@@ -334,7 +334,8 @@ static void __kdbus_pool_slice_release(struct kdbus_pool_slice *slice)
 
        if (child) {
                /* Only allow one level of recursion */
-               BUG_ON(child->child);
+               WARN_ON(child->child);
+               WARN_ON(!child->ref_kernel);
                child->ref_kernel = false;
                __kdbus_pool_slice_release(child);
        }