From: Christoph Hellwig <hch@lst.de>
To: Linus Torvalds <torvalds@linux-foundation.org>,
Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, libc-alpha@sourceware.org
Subject: [PATCH 2/2] fs: reject unknown open flags
Date: Thu, 30 Mar 2017 18:33:27 +0200 [thread overview]
Message-ID: <20170330163327.23920-3-hch@lst.de> (raw)
In-Reply-To: <20170330163327.23920-1-hch@lst.de>
This way userspace can probe for actually supported flags.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/open.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/open.c b/fs/open.c
index 949cef29c3bb..9106ed7310f0 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -900,6 +900,9 @@ static inline int build_open_flags(int flags, umode_t mode, struct open_flags *o
int lookup_flags = 0;
int acc_mode = ACC_MODE(flags);
+ if (flags & ~VALID_OPEN_FLAGS)
+ return -EINVAL;
+
if (flags & (O_CREAT | __O_TMPFILE))
op->mode = (mode & S_IALLUGO) | S_IFREG;
else
--
2.11.0
next prev parent reply other threads:[~2017-03-30 16:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-30 16:33 RFC: reject unknown open flags Christoph Hellwig
2017-03-30 16:33 ` [PATCH 1/2] fs: add a VALID_OPEN_FLAGS Christoph Hellwig
2017-03-30 16:33 ` Christoph Hellwig [this message]
[not found] ` <20170330163327.23920-3-hch-jcswGhMUV9g@public.gmane.org>
2017-03-30 17:03 ` [PATCH 2/2] fs: reject unknown open flags Linus Torvalds
[not found] ` <20170330163327.23920-1-hch-jcswGhMUV9g@public.gmane.org>
2017-03-30 17:08 ` RFC: " Linus Torvalds
[not found] ` <CA+55aFw92r4h4sNW41ifs31ixdZpNmaxY23KthB9R-LXNm7p-w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-30 17:21 ` Christoph Hellwig
[not found] ` <20170330172159.GA24139-jcswGhMUV9g@public.gmane.org>
2017-03-30 18:19 ` Linus Torvalds
[not found] ` <CA+55aFyg5sXb2vjW9Wt45asoveV7E1scqmph6Op6ZFYdGNwsEg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-30 18:26 ` Christoph Hellwig
[not found] ` <20170330182620.GA25251-jcswGhMUV9g@public.gmane.org>
2017-03-30 18:45 ` Linus Torvalds
2017-03-30 20:05 ` Boaz Harrosh
2017-03-30 19:02 ` Paul Eggert
2017-03-30 19:14 ` Linus Torvalds
2017-03-30 19:22 ` Florian Weimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170330163327.23920-3-hch@lst.de \
--to=hch@lst.de \
--cc=libc-alpha@sourceware.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).