diff --git a/fs/file.c b/fs/file.c index 8627dacfc4246fb975ed38f2b2dc8090f7c7202c..ad4a8bf3cf109fd984449eedef5de6bf9fa342e8 100644 --- a/fs/file.c +++ b/fs/file.c @@ -858,6 +858,10 @@ static struct file *__fget_files(struct files_struct *files, unsigned int fd, file = NULL; else if (!get_file_rcu_many(file, refs)) goto loop; + else if (files_lookup_fd_raw(files, fd) != file) { + fput_many(file, refs); + goto loop; + } } rcu_read_unlock();