summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorJ. R. Okajima <hooanon05@yahoo.co.jp>2011-01-14 04:56:04 +0100
committerNick Piggin <npiggin@kernel.dk>2011-01-14 04:56:04 +0100
commitf20877d94a74557b7c28b4ed8920d834c31e0ea5 (patch)
tree88ea4019a1a8a0a3b8c2f24479ec44b353928f3f /fs/namei.c
parentnfs: add missing rcu-walk check (diff)
downloadlinux-f20877d94a74557b7c28b4ed8920d834c31e0ea5.tar.xz
linux-f20877d94a74557b7c28b4ed8920d834c31e0ea5.zip
fs: fix do_last error case when need_reval_dot
When open(2) without O_DIRECTORY opens an existing dir, it should return EISDIR. In do_last(), the variable 'error' is initialized EISDIR, but it is changed by d_revalidate() which returns any positive to represent 'the target dir is valid.' Should we keep and return the initialized 'error' in this case. Signed-off-by: Nick Piggin <npiggin@kernel.dk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 14c73edca9ce..bc24894c5f14 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2122,11 +2122,13 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
dir = nd->path.dentry;
case LAST_DOT:
if (need_reval_dot(dir)) {
- error = d_revalidate(nd->path.dentry, nd);
- if (!error)
- error = -ESTALE;
- if (error < 0)
+ int status = d_revalidate(nd->path.dentry, nd);
+ if (!status)
+ status = -ESTALE;
+ if (status < 0) {
+ error = status;
goto exit;
+ }
}
/* fallthrough */
case LAST_ROOT: