summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2012-05-21 17:30:11 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2012-06-01 12:11:58 -0400
commitaf2f55426d1d888dcc0ba8dc9e9deb49fae38e38 (patch)
tree09a0e9d2b7cc722edf4cd6d1904a98630656a773 /fs
parent54c33e7f95284539e52ec2d99dcdf6efd29b247f (diff)
downloadlinux-3.10-af2f55426d1d888dcc0ba8dc9e9deb49fae38e38.tar.gz
linux-3.10-af2f55426d1d888dcc0ba8dc9e9deb49fae38e38.tar.bz2
linux-3.10-af2f55426d1d888dcc0ba8dc9e9deb49fae38e38.zip
vfs: do_last(): check LOOKUP_DIRECTORY
Check for ENOTDIR before finishing open. This allows this code to be shared between O_CREAT and plain opens. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c
index a7e994bb78c..4767c0588b6 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2386,6 +2386,9 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
error = -EISDIR;
if (S_ISDIR(nd->inode->i_mode))
goto exit;
+ error = -ENOTDIR;
+ if ((nd->flags & LOOKUP_DIRECTORY) && !nd->inode->i_op->lookup)
+ goto exit;
ok:
if (!S_ISREG(nd->inode->i_mode))
will_truncate = 0;