diff --git a/fs/namei.c b/fs/namei.c index 6e6d202fed56c0..c11b7f0e2ab371 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2645,9 +2645,10 @@ static int do_last(struct nameidata *nd, struct path *path, } /* - * 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