diff --git a/fs/namei.c b/fs/namei.c index faf61c35308cb023474f5859c606b8ef164d35c3..e28de846c5919f84ba0f45ea464a4ee91913f7a9 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1119,9 +1119,11 @@ static int fastcall do_path_lookup(int dfd, const char *name, current->total_link_count = 0; retval = link_path_walk(name, nd); out: - if (unlikely(current->audit_context - && nd && nd->dentry && nd->dentry->d_inode)) + if (likely(retval == 0)) { + if (unlikely(current->audit_context && nd && nd->dentry && + nd->dentry->d_inode)) audit_inode(name, nd->dentry->d_inode, flags); + } return retval; fput_unlock_fail: