diff options
author | J. Bruce Fields <bfields@fieldses.org> | 2006-11-08 20:44:40 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-11-08 21:29:23 -0500 |
commit | 81ac95c5569d7a60ab5db6c1ccec56c12b3ebcb5 (patch) | |
tree | c28ac039697a462527e2aedc4f0c7575d76fbbb1 /fs/nfsd/nfs4proc.c | |
parent | af85852de0b32d92b14295aa6f5ba3a9ad044cf6 (diff) |
[PATCH] nfsd4: fix open-create permissions
In the case where an open creates the file, we shouldn't be rechecking
permissions to open the file; the open succeeds regardless of what the new
file's mode bits say.
This patch fixes the problem, but only by introducing yet another parameter
to nfsd_create_v3. This is ugly. This will be fixed by later patches.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Acked-by: Neil Brown <neilb@suse.de>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfsd/nfs4proc.c')
-rw-r--r-- | fs/nfsd/nfs4proc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 4a73f5b2546f..50bc94243ca1 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -93,6 +93,7 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o | |||
93 | { | 93 | { |
94 | struct svc_fh resfh; | 94 | struct svc_fh resfh; |
95 | __be32 status; | 95 | __be32 status; |
96 | int created = 0; | ||
96 | 97 | ||
97 | fh_init(&resfh, NFS4_FHSIZE); | 98 | fh_init(&resfh, NFS4_FHSIZE); |
98 | open->op_truncate = 0; | 99 | open->op_truncate = 0; |
@@ -105,7 +106,7 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o | |||
105 | status = nfsd_create_v3(rqstp, current_fh, open->op_fname.data, | 106 | status = nfsd_create_v3(rqstp, current_fh, open->op_fname.data, |
106 | open->op_fname.len, &open->op_iattr, | 107 | open->op_fname.len, &open->op_iattr, |
107 | &resfh, open->op_createmode, | 108 | &resfh, open->op_createmode, |
108 | (u32 *)open->op_verf.data, &open->op_truncate); | 109 | (u32 *)open->op_verf.data, &open->op_truncate, &created); |
109 | } else { | 110 | } else { |
110 | status = nfsd_lookup(rqstp, current_fh, | 111 | status = nfsd_lookup(rqstp, current_fh, |
111 | open->op_fname.data, open->op_fname.len, &resfh); | 112 | open->op_fname.data, open->op_fname.len, &resfh); |
@@ -122,7 +123,8 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o | |||
122 | memcpy(open->op_stateowner->so_replay.rp_openfh, | 123 | memcpy(open->op_stateowner->so_replay.rp_openfh, |
123 | &resfh.fh_handle.fh_base, resfh.fh_handle.fh_size); | 124 | &resfh.fh_handle.fh_base, resfh.fh_handle.fh_size); |
124 | 125 | ||
125 | status = do_open_permission(rqstp, current_fh, open, MAY_NOP); | 126 | if (!created) |
127 | status = do_open_permission(rqstp, current_fh, open, MAY_NOP); | ||
126 | 128 | ||
127 | out: | 129 | out: |
128 | fh_put(&resfh); | 130 | fh_put(&resfh); |