mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
bcachefs: Fix validate_bset() repair path
When we truncate a bset (due to it extending past the end of the btree node), we can't skip the rest of the validation for e.g. the packed format (if it's the first bset in the node). Reported-by: syzbot+4d722d3c539d77c7bc82@syzkaller.appspotmail.com Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
f8f1dde686
commit
dc537189b5
@ -733,11 +733,8 @@ static int validate_bset(struct bch_fs *c, struct bch_dev *ca,
|
|||||||
c, ca, b, i, NULL,
|
c, ca, b, i, NULL,
|
||||||
bset_past_end_of_btree_node,
|
bset_past_end_of_btree_node,
|
||||||
"bset past end of btree node (offset %u len %u but written %zu)",
|
"bset past end of btree node (offset %u len %u but written %zu)",
|
||||||
offset, sectors, ptr_written ?: btree_sectors(c))) {
|
offset, sectors, ptr_written ?: btree_sectors(c)))
|
||||||
i->u64s = 0;
|
i->u64s = 0;
|
||||||
ret = 0;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
btree_err_on(offset && !i->u64s,
|
btree_err_on(offset && !i->u64s,
|
||||||
-BCH_ERR_btree_node_read_err_fixable,
|
-BCH_ERR_btree_node_read_err_fixable,
|
||||||
@ -829,7 +826,6 @@ static int validate_bset(struct bch_fs *c, struct bch_dev *ca,
|
|||||||
BSET_BIG_ENDIAN(i), write,
|
BSET_BIG_ENDIAN(i), write,
|
||||||
&bn->format);
|
&bn->format);
|
||||||
}
|
}
|
||||||
out:
|
|
||||||
fsck_err:
|
fsck_err:
|
||||||
printbuf_exit(&buf2);
|
printbuf_exit(&buf2);
|
||||||
printbuf_exit(&buf1);
|
printbuf_exit(&buf1);
|
||||||
|
Loading…
Reference in New Issue
Block a user