From: Al Viro Date: Mon, 9 Jul 2018 01:45:07 +0000 (-0400) Subject: make sure do_dentry_open() won't return positive as an error X-Git-Tag: v4.19~455^2~36 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6b4e8085c0004382b985a5c005c685073630e746;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Al Viro --- diff --git a/fs/open.c b/fs/open.c index 76c5696..530da96 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);