Skip to content

Commit b30b70a

Browse files
author
Kent Overstreet
committed
bcachefs: Fix early error path in bch2_fs_btree_key_cache_exit()
Reported-by: syzbot+a35cdb62ec34d44fb062@syzkaller.appspotmail.com Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent a2ddaf9 commit b30b70a

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

fs/bcachefs/btree_key_cache.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -956,13 +956,15 @@ void bch2_fs_btree_key_cache_exit(struct btree_key_cache *bc)
956956
}
957957

958958
#ifdef __KERNEL__
959-
for_each_possible_cpu(cpu) {
960-
struct btree_key_cache_freelist *f =
961-
per_cpu_ptr(bc->pcpu_freed, cpu);
962-
963-
for (i = 0; i < f->nr; i++) {
964-
ck = f->objs[i];
965-
list_add(&ck->list, &items);
959+
if (bc->pcpu_freed) {
960+
for_each_possible_cpu(cpu) {
961+
struct btree_key_cache_freelist *f =
962+
per_cpu_ptr(bc->pcpu_freed, cpu);
963+
964+
for (i = 0; i < f->nr; i++) {
965+
ck = f->objs[i];
966+
list_add(&ck->list, &items);
967+
}
966968
}
967969
}
968970
#endif

0 commit comments

Comments
 (0)