diff options
author | Suzuki <suzuki@In.ibm.com> | 2006-02-07 15:58:36 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-07 19:12:32 -0500 |
commit | 3bc8414b079ec372485c99ed1f33c6c42ca9d756 (patch) | |
tree | bdb939f8ef5ad746ac61948c8476683c9e83334f /fs | |
parent | c00a76aea339b427b47ddc28de06dee0a652e801 (diff) |
[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: Suzuki K P <suzuki@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/namei.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/namei.c b/fs/namei.c index faf61c35308c..e28de846c591 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1119,9 +1119,11 @@ static int fastcall do_path_lookup(int dfd, const char *name, | |||
1119 | current->total_link_count = 0; | 1119 | current->total_link_count = 0; |
1120 | retval = link_path_walk(name, nd); | 1120 | retval = link_path_walk(name, nd); |
1121 | out: | 1121 | out: |
1122 | if (unlikely(current->audit_context | 1122 | if (likely(retval == 0)) { |
1123 | && nd && nd->dentry && nd->dentry->d_inode)) | 1123 | if (unlikely(current->audit_context && nd && nd->dentry && |
1124 | nd->dentry->d_inode)) | ||
1124 | audit_inode(name, nd->dentry->d_inode, flags); | 1125 | audit_inode(name, nd->dentry->d_inode, flags); |
1126 | } | ||
1125 | return retval; | 1127 | return retval; |
1126 | 1128 | ||
1127 | fput_unlock_fail: | 1129 | fput_unlock_fail: |