Skip to content

Commit 472237b

Browse files
peiliiKent Overstreet
authored andcommitted
bcachefs: Fix shift-out-of-bounds in bch2_blacklist_entries_gc
This series fix the shift-out-of-bounds issue in bch2_blacklist_entries_gc(). Instead of passing 0 to eytzinger0_first() when iterating the entries, we explicitly check 0 and initialize i to be 0. syzbot has tested the proposed patch and the reproducer did not trigger any issue: Reported-and-tested-by: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=835d255ad6bc7f29ee12 Signed-off-by: Pei Li <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
1 parent 211c581 commit 472237b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/bcachefs/journal_seq_blacklist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ bool bch2_blacklist_entries_gc(struct bch_fs *c)
232232
BUG_ON(nr != t->nr);
233233

234234
unsigned i;
235-
for (src = bl->start, i = eytzinger0_first(t->nr);
235+
for (src = bl->start, i = t->nr == 0 ? 0 : eytzinger0_first(t->nr);
236236
src < bl->start + nr;
237237
src++, i = eytzinger0_next(i, nr)) {
238238
BUG_ON(t->entries[i].start != le64_to_cpu(src->start));

0 commit comments

Comments
 (0)