summaryrefslogtreecommitdiff
path: root/libbcachefs/sb-clean.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-04-25 16:25:29 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2024-04-25 16:25:29 -0400
commitb9e48edba7efdb7c850f2b9b7e96fe8f7e73edaf (patch)
tree36850b0557691f162cbdad680a4d13c2739bdd6d /libbcachefs/sb-clean.c
parentec2d118738facd1456a25bb67015e67094010b99 (diff)
Update bcachefs sources to 035773e55b52 bcachefs: fix integer conversion bug
Diffstat (limited to 'libbcachefs/sb-clean.c')
-rw-r--r--libbcachefs/sb-clean.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libbcachefs/sb-clean.c b/libbcachefs/sb-clean.c
index 5980ba25..35ca3f13 100644
--- a/libbcachefs/sb-clean.c
+++ b/libbcachefs/sb-clean.c
@@ -29,6 +29,14 @@ int bch2_sb_clean_validate_late(struct bch_fs *c, struct bch_sb_field_clean *cle
for (entry = clean->start;
entry < (struct jset_entry *) vstruct_end(&clean->field);
entry = vstruct_next(entry)) {
+ if (vstruct_end(entry) > vstruct_end(&clean->field)) {
+ bch_err(c, "journal entry (u64s %u) overran end of superblock clean section (u64s %u) by %zu",
+ le16_to_cpu(entry->u64s), le32_to_cpu(clean->field.u64s),
+ (u64 *) vstruct_end(entry) - (u64 *) vstruct_end(&clean->field));
+ bch2_sb_error_count(c, BCH_FSCK_ERR_sb_clean_entry_overrun);
+ return -BCH_ERR_fsck_repair_unimplemented;
+ }
+
ret = bch2_journal_entry_validate(c, NULL, entry,
le16_to_cpu(c->disk_sb.sb->version),
BCH_SB_BIG_ENDIAN(c->disk_sb.sb),