Skip to content

Commit ab0fc21

Browse files
ChenXiaoSongTrond Myklebust
authored andcommitted
Revert "NFSv4: Handle the special Linux file open access mode"
This reverts commit 44942b4. After secondly opening a file with O_ACCMODE|O_DIRECT flags, nfs4_valid_open_stateid() will dereference NULL nfs4_state when lseek(). Reproducer: 1. mount -t nfs -o vers=4.2 $server_ip:/ /mnt/ 2. fd = open("/mnt/file", O_ACCMODE|O_DIRECT|O_CREAT) 3. close(fd) 4. fd = open("/mnt/file", O_ACCMODE|O_DIRECT) 5. lseek(fd) Reported-by: Lyu Tao <[email protected]> Signed-off-by: ChenXiaoSong <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent 7c9d845 commit ab0fc21

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

fs/nfs/inode.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,6 @@ int nfs_open(struct inode *inode, struct file *filp)
11801180
nfs_fscache_open_file(inode, filp);
11811181
return 0;
11821182
}
1183-
EXPORT_SYMBOL_GPL(nfs_open);
11841183

11851184
/*
11861185
* 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
@@ -51,7 +51,7 @@ nfs4_file_open(struct inode *inode, struct file *filp)
5151
return err;
5252

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

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

0 commit comments

Comments
 (0)