mirror of
https://github.com/torvalds/linux
synced 2024-09-30 00:10:51 +00:00
bcachefs: Fix a null ptr deref in bch2_fs_alloc() error path
This fixes a null ptr deref in bch2_free_pending_node_rewrites() when the list head wasn't initialized. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
0b9fbce235
commit
65db60490a
|
@ -2452,7 +2452,7 @@ void bch2_fs_btree_interior_update_exit(struct bch_fs *c)
|
|||
mempool_exit(&c->btree_interior_update_pool);
|
||||
}
|
||||
|
||||
int bch2_fs_btree_interior_update_init(struct bch_fs *c)
|
||||
void bch2_fs_btree_interior_update_init_early(struct bch_fs *c)
|
||||
{
|
||||
mutex_init(&c->btree_reserve_cache_lock);
|
||||
INIT_LIST_HEAD(&c->btree_interior_update_list);
|
||||
|
@ -2462,7 +2462,10 @@ int bch2_fs_btree_interior_update_init(struct bch_fs *c)
|
|||
|
||||
INIT_LIST_HEAD(&c->pending_node_rewrites);
|
||||
mutex_init(&c->pending_node_rewrites_lock);
|
||||
}
|
||||
|
||||
int bch2_fs_btree_interior_update_init(struct bch_fs *c)
|
||||
{
|
||||
c->btree_interior_update_worker =
|
||||
alloc_workqueue("btree_update", WQ_UNBOUND|WQ_MEM_RECLAIM, 1);
|
||||
if (!c->btree_interior_update_worker)
|
||||
|
|
|
@ -322,6 +322,7 @@ void bch2_do_pending_node_rewrites(struct bch_fs *);
|
|||
void bch2_free_pending_node_rewrites(struct bch_fs *);
|
||||
|
||||
void bch2_fs_btree_interior_update_exit(struct bch_fs *);
|
||||
void bch2_fs_btree_interior_update_init_early(struct bch_fs *);
|
||||
int bch2_fs_btree_interior_update_init(struct bch_fs *);
|
||||
|
||||
#endif /* _BCACHEFS_BTREE_UPDATE_INTERIOR_H */
|
||||
|
|
|
@ -686,6 +686,7 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
|
|||
|
||||
bch2_fs_copygc_init(c);
|
||||
bch2_fs_btree_key_cache_init_early(&c->btree_key_cache);
|
||||
bch2_fs_btree_interior_update_init_early(c);
|
||||
bch2_fs_allocator_background_init(c);
|
||||
bch2_fs_allocator_foreground_init(c);
|
||||
bch2_fs_rebalance_init(c);
|
||||
|
|
Loading…
Reference in a new issue