From: Kent Overstreet Date: Sun, 10 Apr 2022 18:36:10 +0000 (-0400) Subject: bcachefs: Fix a null ptr deref X-Git-Tag: v6.7-rc1~201^2~989 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6e811bbbc2ea3b20854c45fa29811640881bb534;p=thirdparty%2Fkernel%2Flinux.git bcachefs: Fix a null ptr deref We start doing allocations before the GC thread is created, which means we need to check for that to avoid a null ptr deref. Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/btree_gc.h b/fs/bcachefs/btree_gc.h index 8de54005e4eaf..95d803b5743de 100644 --- a/fs/bcachefs/btree_gc.h +++ b/fs/bcachefs/btree_gc.h @@ -105,7 +105,8 @@ static inline bool gc_visited(struct bch_fs *c, struct gc_pos pos) static inline void bch2_do_gc_gens(struct bch_fs *c) { atomic_inc(&c->kick_gc); - wake_up_process(c->gc_thread); + if (c->gc_thread) + wake_up_process(c->gc_thread); } #endif /* _BCACHEFS_BTREE_GC_H */