mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-03 22:57:21 -04:00
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>
This commit is contained in:
@@ -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 @@ static void ec_stripe_create(struct ec_stripe_new *s)
|
||||
}
|
||||
}
|
||||
|
||||
bch2_stripe_close(c, s);
|
||||
|
||||
ec_stripe_buf_exit(&s->existing_stripe);
|
||||
ec_stripe_buf_exit(&s->new_stripe);
|
||||
closure_debug_destroy(&s->iodone);
|
||||
|
||||
Reference in New Issue
Block a user