Re: [syzbot] [nilfs?] [mm?] KASAN: slab-use-after-free Read in lru_add_fn

From: Hillf Danton
Date: Wed Jun 12 2024 - 06:45:57 EST


On Tue, 11 Jun 2024 11:10:20 -0700
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 83a7eefedc9b Linux 6.10-rc3
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17c645e2980000

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

--- x/fs/read_write.c
+++ y/fs/read_write.c 2024-06-12 18:38:40.826180800 +0800
@@ -583,6 +583,7 @@ ssize_t vfs_write(struct file *file, con
return ret;
if (count > MAX_RW_COUNT)
count = MAX_RW_COUNT;
+ ihold(file_inode(file));
file_start_write(file);
if (file->f_op->write)
ret = file->f_op->write(file, buf, count, pos);
@@ -596,6 +597,7 @@ ssize_t vfs_write(struct file *file, con
}
inc_syscw(current);
file_end_write(file);
+ iput(file_inode(file));
return ret;
}

--