lkml.org 
[lkml]   [2018]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC][PATCH 04/27] make sure do_dentry_open() won't return positive as an error
Date
From: Al Viro <viro@zeniv.linux.org.uk>

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.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
fs/open.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/fs/open.c b/fs/open.c
index d0e955b558ad..40658ef912d2 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -812,6 +812,10 @@ static int do_dentry_open(struct file *f,
return 0;

cleanup_all:
+ if (unlikely(error > 0)) {
+ WARN_ON(1);
+ error = -EINVAL;
+ }
fops_put(f->f_op);
if (f->f_mode & FMODE_WRITER) {
put_write_access(inode);
--
2.11.0
\
 
 \ /
  Last update: 2018-07-09 06:54    [W:0.070 / U:3.696 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site