diff options
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfsfh.c | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index d0d8a217a3ea..a77efb8c2243 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c | |||
@@ -233,14 +233,6 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp) | |||
233 | goto out; | 233 | goto out; |
234 | } | 234 | } |
235 | 235 | ||
236 | if (exp->ex_flags & NFSEXP_NOSUBTREECHECK) { | ||
237 | error = nfsd_setuser_and_check_port(rqstp, exp); | ||
238 | if (error) { | ||
239 | dput(dentry); | ||
240 | goto out; | ||
241 | } | ||
242 | } | ||
243 | |||
244 | if (S_ISDIR(dentry->d_inode->i_mode) && | 236 | if (S_ISDIR(dentry->d_inode->i_mode) && |
245 | (dentry->d_flags & DCACHE_DISCONNECTED)) { | 237 | (dentry->d_flags & DCACHE_DISCONNECTED)) { |
246 | printk("nfsd: find_fh_dentry returned a DISCONNECTED directory: %s/%s\n", | 238 | printk("nfsd: find_fh_dentry returned a DISCONNECTED directory: %s/%s\n", |
@@ -295,28 +287,28 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
295 | error = nfsd_set_fh_dentry(rqstp, fhp); | 287 | error = nfsd_set_fh_dentry(rqstp, fhp); |
296 | if (error) | 288 | if (error) |
297 | goto out; | 289 | goto out; |
298 | dentry = fhp->fh_dentry; | ||
299 | exp = fhp->fh_export; | ||
300 | } else { | ||
301 | /* | ||
302 | * just rechecking permissions | ||
303 | * (e.g. nfsproc_create calls fh_verify, then nfsd_create | ||
304 | * does as well) | ||
305 | */ | ||
306 | dprintk("nfsd: fh_verify - just checking\n"); | ||
307 | dentry = fhp->fh_dentry; | ||
308 | exp = fhp->fh_export; | ||
309 | /* | ||
310 | * Set user creds for this exportpoint; necessary even | ||
311 | * in the "just checking" case because this may be a | ||
312 | * filehandle that was created by fh_compose, and that | ||
313 | * is about to be used in another nfsv4 compound | ||
314 | * operation. | ||
315 | */ | ||
316 | error = nfsd_setuser_and_check_port(rqstp, exp); | ||
317 | if (error) | ||
318 | goto out; | ||
319 | } | 290 | } |
291 | dentry = fhp->fh_dentry; | ||
292 | exp = fhp->fh_export; | ||
293 | /* | ||
294 | * We still have to do all these permission checks, even when | ||
295 | * fh_dentry is already set: | ||
296 | * - fh_verify may be called multiple times with different | ||
297 | * "access" arguments (e.g. nfsd_proc_create calls | ||
298 | * fh_verify(...,NFSD_MAY_EXEC) first, then later (in | ||
299 | * nfsd_create) calls fh_verify(...,NFSD_MAY_CREATE). | ||
300 | * - in the NFSv4 case, the filehandle may have been filled | ||
301 | * in by fh_compose, and given a dentry, but further | ||
302 | * compound operations performed with that filehandle | ||
303 | * still need permissions checks. In the worst case, a | ||
304 | * mountpoint crossing may have changed the export | ||
305 | * options, and we may now need to use a different uid | ||
306 | * (for example, if different id-squashing options are in | ||
307 | * effect on the new filesystem). | ||
308 | */ | ||
309 | error = nfsd_setuser_and_check_port(rqstp, exp); | ||
310 | if (error) | ||
311 | goto out; | ||
320 | 312 | ||
321 | error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type); | 313 | error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type); |
322 | if (error) | 314 | if (error) |