* [PATCH] nfs: verify open flags before allowing an atomic open
@ 2013-08-02 15:39 Jeff Layton
0 siblings, 0 replies; only message in thread
From: Jeff Layton @ 2013-08-02 15:39 UTC (permalink / raw)
To: Trond Myklebust; +Cc: linux-nfs, Chao Ye
Currently, you can open a NFSv4 file with O_APPEND|O_DIRECT, but cannot
fcntl(F_SETFL,...) with those flags. This flag combination is explicitly
forbidden on NFSv3 opens, and it seems like it should also be on NFSv4.
Reported-by: Chao Ye <cye@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
fs/nfs/dir.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index e474ca2b..39e69d4 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1413,6 +1413,10 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
dfprintk(VFS, "NFS: atomic_open(%s/%ld), %s\n",
dir->i_sb->s_id, dir->i_ino, dentry->d_name.name);
+ err = nfs_check_flags(open_flags);
+ if (err)
+ return err;
+
/* NFS only supports OPEN on regular files */
if ((open_flags & O_DIRECTORY)) {
if (!d_unhashed(dentry)) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-08-02 15:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-02 15:39 [PATCH] nfs: verify open flags before allowing an atomic open Jeff Layton
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).