things will break wildly if we leave a stack allocated closure on a
waitlist

Reported-by: syzbot+0ea2c41a649240197...@syzkaller.appspotmail.com
Signed-off-by: Kent Overstreet <kent.overstr...@linux.dev>
---
 fs/bcachefs/ec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c
index 62dda821247e..bea14f02114f 100644
--- a/fs/bcachefs/ec.c
+++ b/fs/bcachefs/ec.c
@@ -2060,6 +2060,9 @@ struct ec_stripe_head *bch2_ec_stripe_head_get(struct 
btree_trans *trans,
        BUG_ON(trans->restarted);
        return h;
 err:
+       if (waiting &&
+           !bch2_err_matches(ret, BCH_ERR_operation_blocked))
+               closure_wake_up(&c->freelist_wait);
        bch2_ec_stripe_head_put(c, h);
        return ERR_PTR(ret);
 }
-- 
2.50.0


Reply via email to