diff --git a/fs/namei.c b/fs/namei.c index 4af778f32baf71..5bb3d576cd465b 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2648,9 +2648,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