Skip to content

Commit 44942b4

Browse files
author
Trond Myklebust
committed
NFSv4: Handle the special Linux file open access mode
According to the open() manpage, Linux reserves the access mode 3 to mean "check for read and write permission on the file and return a file descriptor that can't be used for reading or writing." Currently, the NFSv4 code will ask the server to open the file, and will use an incorrect share access mode of 0. Since it has an incorrect share access mode, the client later forgets to send a corresponding close, meaning it can leak stateids on the server. Fixes: ce4ef7c ("NFS: Split out NFS v4 file operations") Cc: [email protected] # 3.6+ Signed-off-by: Trond Myklebust <[email protected]>
1 parent 1bf85d8 commit 44942b4

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

fs/nfs/inode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,7 @@ int nfs_open(struct inode *inode, struct file *filp)
11001100
nfs_fscache_open_file(inode, filp);
11011101
return 0;
11021102
}
1103+
EXPORT_SYMBOL_GPL(nfs_open);
11031104

11041105
/*
11051106
* This function is called whenever some part of NFS notices that

fs/nfs/nfs4file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ nfs4_file_open(struct inode *inode, struct file *filp)
4949
return err;
5050

5151
if ((openflags & O_ACCMODE) == 3)
52-
openflags--;
52+
return nfs_open(inode, filp);
5353

5454
/* We can't create new files here */
5555
openflags &= ~(O_CREAT|O_EXCL);

0 commit comments

Comments
 (0)