Commit 3bc8414b authored by Suzuki's avatar Suzuki Committed by 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: default avatarSuzuki K P <suzuki@in.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c00a76ae
...@@ -1119,9 +1119,11 @@ static int fastcall do_path_lookup(int dfd, const char *name, ...@@ -1119,9 +1119,11 @@ static int fastcall do_path_lookup(int dfd, const char *name,
current->total_link_count = 0; current->total_link_count = 0;
retval = link_path_walk(name, nd); retval = link_path_walk(name, nd);
out: out:
if (unlikely(current->audit_context if (likely(retval == 0)) {
&& nd && nd->dentry && nd->dentry->d_inode)) if (unlikely(current->audit_context && nd && nd->dentry &&
nd->dentry->d_inode))
audit_inode(name, nd->dentry->d_inode, flags); audit_inode(name, nd->dentry->d_inode, flags);
}
return retval; return retval;
fput_unlock_fail: fput_unlock_fail:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment