From: Jeff Layton Date: Fri, 2 Aug 2013 15:39:32 +0000 (-0400) Subject: nfs: verify open flags before allowing an atomic open X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=9597c13b;p=deliverable%2Flinux.git nfs: verify open flags before allowing an atomic open 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 Signed-off-by: Jeff Layton Signed-off-by: Trond Myklebust --- diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index e474ca2b2bfe..39e69d47cd0b 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)) {