Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfsd4: fix share mode permissions

NFSv4 opens may function as locks denying other NFSv4 users the rights
to open a file.

We're requiring a user to have write permissions before they can deny
write. We're *not* requiring a user to have write permissions to deny
read, which is if anything a more drastic denial.

What was intended was to require write permissions for DENY_READ.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>

+1 -1
+1 -1
fs/nfsd/nfs4proc.c
··· 171 171 accmode |= NFSD_MAY_READ; 172 172 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) 173 173 accmode |= (NFSD_MAY_WRITE | NFSD_MAY_TRUNC); 174 - if (open->op_share_deny & NFS4_SHARE_DENY_WRITE) 174 + if (open->op_share_deny & NFS4_SHARE_DENY_READ) 175 175 accmode |= NFSD_MAY_WRITE; 176 176 177 177 status = fh_verify(rqstp, current_fh, S_IFREG, accmode);