diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-04-10 14:36:10 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:31 -0400 |
commit | 6e811bbbc2ea3b20854c45fa29811640881bb534 (patch) | |
tree | 367accfa358145bde9183fea2a940ba9cbbe63be /fs/bcachefs/btree_gc.h | |
parent | cf0dd697ebc9090d0aeafa933e0e688e291a24fc (diff) | |
download | linux-6e811bbbc2ea3b20854c45fa29811640881bb534.tar.gz linux-6e811bbbc2ea3b20854c45fa29811640881bb534.tar.bz2 linux-6e811bbbc2ea3b20854c45fa29811640881bb534.zip |
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 <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/btree_gc.h')
-rw-r--r-- | fs/bcachefs/btree_gc.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bcachefs/btree_gc.h b/fs/bcachefs/btree_gc.h index 8de54005e4ea..95d803b5743d 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 */ |