提交 9a25b96c 编写于 作者: J J. Bruce Fields 提交者: Linus Torvalds

nfsd: return errors, not NULL, from export functions

I converted the various export-returning functions to return -ENOENT instead
of NULL, but missed a few cases.

This particular case could cause actual bugs in the case of a krb5 client that
doesn't match any ip-based client and that is trying to access a filesystem
not exported to krb5 clients.
Signed-off-by: N"J. Bruce Fields" <bfields@citi.umich.edu>
Acked-by: NNeil Brown <neilb@suse.de>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 a280df32
...@@ -1265,7 +1265,7 @@ struct svc_export * ...@@ -1265,7 +1265,7 @@ struct svc_export *
rqst_exp_get_by_name(struct svc_rqst *rqstp, struct vfsmount *mnt, rqst_exp_get_by_name(struct svc_rqst *rqstp, struct vfsmount *mnt,
struct dentry *dentry) struct dentry *dentry)
{ {
struct svc_export *gssexp, *exp = NULL; struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT);
if (rqstp->rq_client == NULL) if (rqstp->rq_client == NULL)
goto gss; goto gss;
...@@ -1288,7 +1288,7 @@ rqst_exp_get_by_name(struct svc_rqst *rqstp, struct vfsmount *mnt, ...@@ -1288,7 +1288,7 @@ rqst_exp_get_by_name(struct svc_rqst *rqstp, struct vfsmount *mnt,
&rqstp->rq_chandle); &rqstp->rq_chandle);
if (PTR_ERR(gssexp) == -ENOENT) if (PTR_ERR(gssexp) == -ENOENT)
return exp; return exp;
if (exp && !IS_ERR(exp)) if (!IS_ERR(exp))
exp_put(exp); exp_put(exp);
return gssexp; return gssexp;
} }
...@@ -1296,7 +1296,7 @@ rqst_exp_get_by_name(struct svc_rqst *rqstp, struct vfsmount *mnt, ...@@ -1296,7 +1296,7 @@ rqst_exp_get_by_name(struct svc_rqst *rqstp, struct vfsmount *mnt,
struct svc_export * struct svc_export *
rqst_exp_find(struct svc_rqst *rqstp, int fsid_type, u32 *fsidv) rqst_exp_find(struct svc_rqst *rqstp, int fsid_type, u32 *fsidv)
{ {
struct svc_export *gssexp, *exp = NULL; struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT);
if (rqstp->rq_client == NULL) if (rqstp->rq_client == NULL)
goto gss; goto gss;
...@@ -1318,7 +1318,7 @@ rqst_exp_find(struct svc_rqst *rqstp, int fsid_type, u32 *fsidv) ...@@ -1318,7 +1318,7 @@ rqst_exp_find(struct svc_rqst *rqstp, int fsid_type, u32 *fsidv)
&rqstp->rq_chandle); &rqstp->rq_chandle);
if (PTR_ERR(gssexp) == -ENOENT) if (PTR_ERR(gssexp) == -ENOENT)
return exp; return exp;
if (exp && !IS_ERR(exp)) if (!IS_ERR(exp))
exp_put(exp); exp_put(exp);
return gssexp; return gssexp;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册