]> err.no Git - linux-2.6/commitdiff
[PATCH] knfsd: nfsd4: fix open permission checking
authorJ. Bruce Fields <bfields@fieldses.org>
Tue, 17 Oct 2006 07:10:14 +0000 (00:10 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 17 Oct 2006 15:18:46 +0000 (08:18 -0700)
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>
fs/nfsd/nfs4proc.c

index a05d3376cc4669db17f6281b160fe7604ec02585..d1fac6872c44e732728e21dd66fdbcbc02d14bf1 100644 (file)
@@ -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);