vfs: don't let do_last pass negative dentry to audit_inode
[platform/adaptation/renesas_rcar/renesas_kernel.git] / fs / namei.c
index a3fb78f..afa0876 100644 (file)
@@ -2608,9 +2608,10 @@ retry_lookup:
        }
 
        /*
-        * It already exists.
+        * create/update audit record if it already exists.
         */
-       audit_inode(pathname, path->dentry);
+       if (path->dentry->d_inode)
+               audit_inode(pathname, path->dentry);
 
        /*
         * If atomic_open() acquired write access it is dropped now due to