diff options
author | NeilBrown <neilb@suse.de> | 2006-07-30 06:03:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-31 16:28:37 -0400 |
commit | d1bbf14f37261c2c0dba71404602e1ddcec069d2 (patch) | |
tree | 7b01141c31b73f277079cbcdb88be6ac8da2add1 /fs/nfsd | |
parent | a5ca63cb60892c1703998daf80d2d1b04cb70103 (diff) |
[PATCH] knfsd: Fix stale file handle problem with subtree_checking.
A recent commit (7fc90ec93a5eb71f4b08403baf5ba7176b3ec6b1) moved the
call to nfsd_setuser out of the 'find a dentry for a filehandle' branch
of fh_verify so that it would always be called.
This had the unfortunately side-effect of moving *after* the call to
decode_fh, so the prober fsuid was not set when nfsd_acceptable was called,
the 'permission' check did the wrong thing.
This patch moves the nfsd_setuser call back where it was, and add as call
in the other branch of the if.
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfsfh.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index ecc439d2565f..501d83884530 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c | |||
@@ -187,6 +187,11 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
187 | goto out; | 187 | goto out; |
188 | } | 188 | } |
189 | 189 | ||
190 | /* Set user creds for this exportpoint */ | ||
191 | error = nfserrno(nfsd_setuser(rqstp, exp)); | ||
192 | if (error) | ||
193 | goto out; | ||
194 | |||
190 | /* | 195 | /* |
191 | * Look up the dentry using the NFS file handle. | 196 | * Look up the dentry using the NFS file handle. |
192 | */ | 197 | */ |
@@ -241,16 +246,17 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
241 | dprintk("nfsd: fh_verify - just checking\n"); | 246 | dprintk("nfsd: fh_verify - just checking\n"); |
242 | dentry = fhp->fh_dentry; | 247 | dentry = fhp->fh_dentry; |
243 | exp = fhp->fh_export; | 248 | exp = fhp->fh_export; |
249 | /* Set user creds for this exportpoint; necessary even | ||
250 | * in the "just checking" case because this may be a | ||
251 | * filehandle that was created by fh_compose, and that | ||
252 | * is about to be used in another nfsv4 compound | ||
253 | * operation */ | ||
254 | error = nfserrno(nfsd_setuser(rqstp, exp)); | ||
255 | if (error) | ||
256 | goto out; | ||
244 | } | 257 | } |
245 | cache_get(&exp->h); | 258 | cache_get(&exp->h); |
246 | 259 | ||
247 | /* Set user creds for this exportpoint; necessary even in the "just | ||
248 | * checking" case because this may be a filehandle that was created by | ||
249 | * fh_compose, and that is about to be used in another nfsv4 compound | ||
250 | * operation */ | ||
251 | error = nfserrno(nfsd_setuser(rqstp, exp)); | ||
252 | if (error) | ||
253 | goto out; | ||
254 | 260 | ||
255 | error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type); | 261 | error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type); |
256 | if (error) | 262 | if (error) |