Re: [syzbot] [reiserfs?] general protection fault in __fget_files (2)

From: Edward Adam Davis
Date: Fri Jan 05 2024 - 08:20:52 EST


please test general protection fault in __fget_files

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

diff --git a/fs/file.c b/fs/file.c
index 5fb0b146e79e..724f60e6cc4f 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -1134,6 +1134,8 @@ static unsigned long __fget_light(unsigned int fd, fmode_t mask)
return 0;
return (unsigned long)file;
} else {
+ if (!atomic_read_acquire(&files->count))
+ return 0;
file = __fget(fd, mask);
if (!file)
return 0;