]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
don't leak O_CLOEXEC into ->f_flags
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 26 Aug 2012 15:01:04 +0000 (11:01 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 27 Sep 2012 01:10:01 +0000 (21:10 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/open.c
fs/proc/fd.c

index 30760017deed5586ed39a88324aff3b37005fab7..03028d0e74873e4ac2dca61dac0263f4df348e89 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -814,7 +814,7 @@ static inline int build_open_flags(int flags, umode_t mode, struct open_flags *o
                op->mode = 0;
 
        /* Must never be set by userspace */
-       flags &= ~FMODE_NONOTIFY;
+       flags &= ~FMODE_NONOTIFY & ~O_CLOEXEC;
 
        /*
         * O_SYNC is implemented as __O_SYNC|O_DSYNC.  As many places only
index 9cef449c0f76fa68569b70e28514557442a16338..f28a875f8779f8cd1fec3ff8869eb4b2d802764c 100644 (file)
@@ -36,7 +36,7 @@ static int seq_show(struct seq_file *m, void *v)
                if (file) {
                        struct fdtable *fdt = files_fdtable(files);
 
-                       f_flags = file->f_flags & ~O_CLOEXEC;
+                       f_flags = file->f_flags;
                        if (close_on_exec(fd, fdt))
                                f_flags |= O_CLOEXEC;