diff options
author | Jeff Layton <jlayton@redhat.com> | 2013-08-02 11:39:32 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-08-07 12:16:22 -0400 |
commit | 9597c13b2f3c54240b1b902a677672faa70ab7c5 (patch) | |
tree | fb1ba832c4654b68b85198ca8f1fed86045f55e3 /fs | |
parent | 55b592933b7d0091d515ef1663334470a343ec98 (diff) |
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 <cye@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/dir.c | 4 |
1 files changed, 4 insertions, 0 deletions
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, | |||
1413 | dfprintk(VFS, "NFS: atomic_open(%s/%ld), %s\n", | 1413 | dfprintk(VFS, "NFS: atomic_open(%s/%ld), %s\n", |
1414 | dir->i_sb->s_id, dir->i_ino, dentry->d_name.name); | 1414 | dir->i_sb->s_id, dir->i_ino, dentry->d_name.name); |
1415 | 1415 | ||
1416 | err = nfs_check_flags(open_flags); | ||
1417 | if (err) | ||
1418 | return err; | ||
1419 | |||
1416 | /* NFS only supports OPEN on regular files */ | 1420 | /* NFS only supports OPEN on regular files */ |
1417 | if ((open_flags & O_DIRECTORY)) { | 1421 | if ((open_flags & O_DIRECTORY)) { |
1418 | if (!d_unhashed(dentry)) { | 1422 | if (!d_unhashed(dentry)) { |