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;