Commit 6b4e8085 authored by Al Viro's avatar Al Viro

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: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent b10a4a9f
...@@ -812,6 +812,8 @@ static int do_dentry_open(struct file *f, ...@@ -812,6 +812,8 @@ static int do_dentry_open(struct file *f,
return 0; return 0;
cleanup_all: cleanup_all:
if (WARN_ON_ONCE(error > 0))
error = -EINVAL;
fops_put(f->f_op); fops_put(f->f_op);
if (f->f_mode & FMODE_WRITER) { if (f->f_mode & FMODE_WRITER) {
put_write_access(inode); put_write_access(inode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment