summaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-07-09 03:45:07 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2018-07-11 05:29:03 +0200
commit6b4e8085c0004382b985a5c005c685073630e746 (patch)
tree9b7cc4226ab495fd2716e328754294028b973fb3 /fs/open.c
parentcreate_pipe_files(): use fput() if allocation of the second file fails (diff)
downloadlinux-6b4e8085c0004382b985a5c005c685073630e746.tar.xz
linux-6b4e8085c0004382b985a5c005c685073630e746.zip
make sure do_dentry_open() won't return positive as an error
An ->open() instances really, really should not be doing that. There's a lot of places e.g. around atomic_open() that could be confused by that, so let's catch that early. Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/open.c b/fs/open.c
index 76c56966e297..530da965e369 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -812,6 +812,8 @@ static int do_dentry_open(struct file *f,
return 0;
cleanup_all:
+ if (WARN_ON_ONCE(error > 0))
+ error = -EINVAL;
fops_put(f->f_op);
if (f->f_mode & FMODE_WRITER) {
put_write_access(inode);