Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit d93ff5f

Browse files
author
Kent Overstreet
committed
bcachefs: Fix race path in bch2_inode_insert()
__destroy_new_inode() is appropriate when we have _just_allocated the inode, but not when it's been fully initialized and on i_sb_list. Reported-by: syzbot+a0ddc9873c280a4cb18f@syzkaller.appspotmail.com Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent cd3b31f commit d93ff5f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

fs/bcachefs/fs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ static struct bch_inode_info *bch2_inode_insert(struct bch_fs *c, struct bch_ino
188188
BUG_ON(!old);
189189

190190
if (unlikely(old != inode)) {
191-
__destroy_inode(&inode->v);
192-
kmem_cache_free(bch2_inode_cache, inode);
191+
discard_new_inode(&inode->v);
193192
inode = old;
194193
} else {
195194
mutex_lock(&c->vfs_inodes_lock);

0 commit comments

Comments
 (0)