Skip to content

Commit

Permalink
[PATCH] knfsd: nfsd4: fix open permission checking
Browse files Browse the repository at this point in the history
We weren't actually checking for SHARE_ACCESS_WRITE, with the result that the
owner could open a non-writeable file for write!

Continue to allow DENY_WRITE only with write access.

Thanks to Jim Rees for reporting the bug.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
J. Bruce Fields authored and Linus Torvalds committed Oct 17, 2006
1 parent dc730e1 commit 9801d8a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/nfsd/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs

if (open->op_share_access & NFS4_SHARE_ACCESS_READ)
accmode |= MAY_READ;
if (open->op_share_deny & NFS4_SHARE_ACCESS_WRITE)
if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
accmode |= (MAY_WRITE | MAY_TRUNC);
if (open->op_share_deny & NFS4_SHARE_DENY_WRITE)
accmode |= MAY_WRITE;

status = fh_verify(rqstp, current_fh, S_IFREG, accmode);

Expand Down

0 comments on commit 9801d8a

Please sign in to comment.