]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blobdiff - fs/file.c
NFSv4: Handle case where the lookup of a directory fails
[mirror_ubuntu-focal-kernel.git] / fs / file.c
index 3da91a112babe874af392635a32e971d8885937f..fe46ca52a98a8eb2da3d1ac5d1d17dec2cd3d767 100644 (file)
--- a/fs/file.c
+++ b/fs/file.c
@@ -70,7 +70,7 @@ static void copy_fd_bitmaps(struct fdtable *nfdt, struct fdtable *ofdt,
  */
 static void copy_fdtable(struct fdtable *nfdt, struct fdtable *ofdt)
 {
-       unsigned int cpy, set;
+       size_t cpy, set;
 
        BUG_ON(nfdt->max_fds < ofdt->max_fds);
 
@@ -669,6 +669,7 @@ out_unlock:
        *res = NULL;
        return -ENOENT;
 }
+EXPORT_SYMBOL(__close_fd_get_file);
 
 void do_close_on_exec(struct files_struct *files)
 {
@@ -723,6 +724,10 @@ loop:
                        file = NULL;
                else if (!get_file_rcu_many(file, refs))
                        goto loop;
+               else if (__fcheck_files(files, fd) != file) {
+                       fput_many(file, refs);
+                       goto loop;
+               }
        }
        rcu_read_unlock();