Re: [syzbot] [ntfs3?] KASAN: slab-use-after-free Read in chrdev_open

From: Hillf Danton
Date: Sat Jun 15 2024 - 06:41:32 EST


#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 83a7eefedc9b

--- x/fs/open.c
+++ y/fs/open.c
@@ -952,7 +952,11 @@ static int do_dentry_open(struct file *f
if (!open)
open = f->f_op->open;
if (open) {
+ error = -ENODEV;
+ if (!atomic_inc_not_zero(&inode->i_count))
+ goto cleanup_all;
error = open(inode, f);
+ iput(inode);
if (error)
goto cleanup_all;
}
--