mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-24 01:09:38 -05:00
bcachefs: Fix array overrun with unknown btree roots
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
f707e3d8f4
commit
2ded276b7e
1 changed files with 9 additions and 1 deletions
|
@ -379,7 +379,15 @@ static int journal_replay_entry_early(struct bch_fs *c,
|
|||
|
||||
switch (entry->type) {
|
||||
case BCH_JSET_ENTRY_btree_root: {
|
||||
struct btree_root *r = &c->btree_roots[entry->btree_id];
|
||||
struct btree_root *r;
|
||||
|
||||
if (entry->btree_id >= BTREE_ID_NR) {
|
||||
bch_err(c, "filesystem has unknown btree type %u",
|
||||
entry->btree_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
r = &c->btree_roots[entry->btree_id];
|
||||
|
||||
if (entry->u64s) {
|
||||
r->level = entry->level;
|
||||
|
|
Loading…
Add table
Reference in a new issue