Skip to content

Commit

Permalink
nfsd: return errors, not NULL, from export functions
Browse files Browse the repository at this point in the history
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@citi.umich.edu>
Acked-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
J. Bruce Fields authored and Linus Torvalds committed Jul 19, 2007
1 parent a280df3 commit 9a25b96
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fs/nfsd/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,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;
Expand All @@ -1288,15 +1288,15 @@ rqst_exp_get_by_name(struct svc_rqst *rqstp, struct vfsmount *mnt,
&rqstp->rq_chandle);
if (PTR_ERR(gssexp) == -ENOENT)
return exp;
if (exp && !IS_ERR(exp))
if (!IS_ERR(exp))
exp_put(exp);
return gssexp;
}

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;
Expand All @@ -1318,7 +1318,7 @@ rqst_exp_find(struct svc_rqst *rqstp, int fsid_type, u32 *fsidv)
&rqstp->rq_chandle);
if (PTR_ERR(gssexp) == -ENOENT)
return exp;
if (exp && !IS_ERR(exp))
if (!IS_ERR(exp))
exp_put(exp);
return gssexp;
}
Expand Down

0 comments on commit 9a25b96

Please sign in to comment.