[PATCH 1/4] nfsd: return errors, not NULL, from export functions
J. Bruce Fields
bfields at fieldses.org
Fri Jul 13 23:00:23 EDT 2007
From: J. Bruce Fields <bfields at citi.umich.edu>
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: "J. Bruce Fields" <bfields at citi.umich.edu>
---
fs/nfsd/export.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index f6073c6..e5921e4 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -1262,7 +1262,7 @@ struct svc_export *
rqst_exp_get_by_name(struct svc_rqst *rqstp, struct vfsmount *mnt,
struct dentry *dentry)
{
- struct svc_export *gssexp, *exp = NULL;
+ struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT);
if (rqstp->rq_client == NULL)
goto gss;
@@ -1285,7 +1285,7 @@ gss:
&rqstp->rq_chandle);
if (PTR_ERR(gssexp) == -ENOENT)
return exp;
- if (exp && !IS_ERR(exp))
+ if (!IS_ERR(exp))
exp_put(exp);
return gssexp;
}
@@ -1293,7 +1293,7 @@ gss:
struct svc_export *
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)
goto gss;
@@ -1315,7 +1315,7 @@ gss:
&rqstp->rq_chandle);
if (PTR_ERR(gssexp) == -ENOENT)
return exp;
- if (exp && !IS_ERR(exp))
+ if (!IS_ERR(exp))
exp_put(exp);
return gssexp;
}
--
1.5.3.rc0.63.gc956
More information about the NFSv4
mailing list