diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2008-03-14 19:37:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-03-14 19:49:15 -0400 |
commit | b663c6fd98c9cf586279db03cec3257c413efd00 (patch) | |
tree | f268ae9e706044f48d2f95fcb4841ce89c70cf4b /fs | |
parent | 9b89ca7a3847c0d5b1e86e83f4860a866f28a89b (diff) |
nfsd: fix oops on access from high-numbered ports
This bug was always here, but before my commit 6fa02839bf9412e18e77
("recheck for secure ports in fh_verify"), it could only be triggered by
failure of a kmalloc(). After that commit it could be triggered by a
client making a request from a non-reserved port for access to an export
marked "secure". (Exports are "secure" by default.)
The result is a struct svc_export with a reference count one too low,
resulting in likely oopses next time the export is accessed.
The reference counting here is not straightforward; a later patch will
clean up fh_verify().
Thanks to Lukas Hejtmanek for the bug report and followup.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Cc: Lukas Hejtmanek <xhejtman@ics.muni.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/nfsfh.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index 1eb771d79cca..3e6b3f41ee1f 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c | |||
@@ -232,6 +232,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
232 | fhp->fh_dentry = dentry; | 232 | fhp->fh_dentry = dentry; |
233 | fhp->fh_export = exp; | 233 | fhp->fh_export = exp; |
234 | nfsd_nr_verified++; | 234 | nfsd_nr_verified++; |
235 | cache_get(&exp->h); | ||
235 | } else { | 236 | } else { |
236 | /* | 237 | /* |
237 | * just rechecking permissions | 238 | * just rechecking permissions |
@@ -241,6 +242,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
241 | dprintk("nfsd: fh_verify - just checking\n"); | 242 | dprintk("nfsd: fh_verify - just checking\n"); |
242 | dentry = fhp->fh_dentry; | 243 | dentry = fhp->fh_dentry; |
243 | exp = fhp->fh_export; | 244 | exp = fhp->fh_export; |
245 | cache_get(&exp->h); | ||
244 | /* | 246 | /* |
245 | * Set user creds for this exportpoint; necessary even | 247 | * Set user creds for this exportpoint; necessary even |
246 | * in the "just checking" case because this may be a | 248 | * in the "just checking" case because this may be a |
@@ -252,8 +254,6 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
252 | if (error) | 254 | if (error) |
253 | goto out; | 255 | goto out; |
254 | } | 256 | } |
255 | cache_get(&exp->h); | ||
256 | |||
257 | 257 | ||
258 | error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type); | 258 | error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type); |
259 | if (error) | 259 | if (error) |