Commit af2f55426d1d888dcc0ba8dc9e9deb49fae38e38
Committed by
Al Viro
1 parent
54c33e7f95
Exists in
master
and in
20 other branches
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>
Showing 1 changed file with 3 additions and 0 deletions Side-by-side Diff
fs/namei.c
... | ... | @@ -2386,6 +2386,9 @@ |
2386 | 2386 | error = -EISDIR; |
2387 | 2387 | if (S_ISDIR(nd->inode->i_mode)) |
2388 | 2388 | goto exit; |
2389 | + error = -ENOTDIR; | |
2390 | + if ((nd->flags & LOOKUP_DIRECTORY) && !nd->inode->i_op->lookup) | |
2391 | + goto exit; | |
2389 | 2392 | ok: |
2390 | 2393 | if (!S_ISREG(nd->inode->i_mode)) |
2391 | 2394 | will_truncate = 0; |