提交 3bc8414b 编写于 作者: S Suzuki 提交者: Linus Torvalds

[PATCH] Fix do_path_lookup() to add the check for error in link_path_walk()

Fix do_path_lookup() to avoid accessing invalid dentry or inode when the
link_path_walk() has failed.  This should fix Bugme #5897.
Signed-off-by: NSuzuki K P <suzuki@in.ibm.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 c00a76ae
......@@ -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:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册