aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorGravatar Kent Overstreet <kent.overstreet@linux.dev> 2023-02-27 22:30:54 -0500
committerGravatar Kent Overstreet <kent.overstreet@linux.dev> 2023-10-22 17:09:55 -0400
commita64adedb8663ded044e535159b2e723a04396845 (patch)
treed3c3fb699f705c3728e8a6b334f52542a77136e6 /fs
parentbcachefs: Convert constants to consts (diff)
downloadlinux-a64adedb8663ded044e535159b2e723a04396845.tar.gz
linux-a64adedb8663ded044e535159b2e723a04396845.tar.bz2
linux-a64adedb8663ded044e535159b2e723a04396845.zip
bcachefs: ec: Ensure new stripe is closed in error path
This fixes a use-after-free bug. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/ec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c
index 88f319992c37..cb291b2a4dd8 100644
--- a/fs/bcachefs/ec.c
+++ b/fs/bcachefs/ec.c
@@ -1107,8 +1107,6 @@ static void ec_stripe_create(struct ec_stripe_new *s)
bch2_err_str(ret));
goto err;
}
-
- bch2_stripe_close(c, s);
err:
bch2_disk_reservation_put(c, &s->res);
@@ -1124,6 +1122,8 @@ err:
}
}
+ bch2_stripe_close(c, s);
+
ec_stripe_buf_exit(&s->existing_stripe);
ec_stripe_buf_exit(&s->new_stripe);
closure_debug_destroy(&s->iodone);