提交 9801d8a3 编写于 作者: J J. Bruce Fields 提交者: Linus Torvalds

[PATCH] knfsd: nfsd4: fix open permission checking

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: NJ. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: NNeil Brown <neilb@suse.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 dc730e17
...@@ -78,8 +78,10 @@ do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs ...@@ -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) if (open->op_share_access & NFS4_SHARE_ACCESS_READ)
accmode |= MAY_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); 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); status = fh_verify(rqstp, current_fh, S_IFREG, accmode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册