Print out cl->fn - this narrows down the codepaths to look at.

See https://syzkaller.appspot.com/bug?extid=0ea2c41a649240197795

Signed-off-by: Kent Overstreet <kent.overstr...@linux.dev>
---
 lib/closure.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/closure.c b/lib/closure.c
index 2bfe7d2a0048..4fb78d18ee1b 100644
--- a/lib/closure.c
+++ b/lib/closure.c
@@ -13,23 +13,25 @@
 #include <linux/seq_file.h>
 #include <linux/sched/debug.h>
 
-static inline void closure_put_after_sub_checks(int flags)
+static inline void closure_put_after_sub_checks(struct closure *cl, int flags)
 {
        int r = flags & CLOSURE_REMAINING_MASK;
 
        if (WARN(flags & CLOSURE_GUARD_MASK,
-                "closure has guard bits set: %x (%u)",
+                "closure %ps has guard bits set: %x (%u)",
+                cl->fn,
                 flags & CLOSURE_GUARD_MASK, (unsigned) __fls(r)))
                r &= ~CLOSURE_GUARD_MASK;
 
        WARN(!r && (flags & ~CLOSURE_DESTRUCTOR),
-            "closure ref hit 0 with incorrect flags set: %x (%u)",
+            "closure %ps ref hit 0 with incorrect flags set: %x (%u)",
+            cl->fn,
             flags & ~CLOSURE_DESTRUCTOR, (unsigned) __fls(flags));
 }
 
 static inline void closure_put_after_sub(struct closure *cl, int flags)
 {
-       closure_put_after_sub_checks(flags);
+       closure_put_after_sub_checks(cl, flags);
 
        if (!(flags & CLOSURE_REMAINING_MASK)) {
                smp_acquire__after_ctrl_dep();
@@ -167,7 +169,7 @@ void __sched closure_return_sync(struct closure *cl)
        unsigned flags = atomic_sub_return_release(1 + CLOSURE_RUNNING - 
CLOSURE_DESTRUCTOR,
                                                   &cl->remaining);
 
-       closure_put_after_sub_checks(flags);
+       closure_put_after_sub_checks(cl, flags);
 
        if (unlikely(flags & CLOSURE_REMAINING_MASK)) {
                while (1) {
-- 
2.50.0


Reply via email to