vfs_export_lookup: Fix r324054

When using the default address list nam is still valid, the code in
r324054 assumed that is was NULL.

Reported by:	Guy Yur <guyyur@gmail.com>
Tested by:	Guy Yur <guyyur@gmail.com>
This commit is contained in:
manu 2017-10-06 09:02:36 +00:00
parent 7bd570a105
commit 13125fb720

View File

@ -458,18 +458,10 @@ vfs_export_lookup(struct mount *mp, struct sockaddr *nam)
if ((mp->mnt_flag & MNT_EXPORTED) == 0)
return (NULL);
/*
* If no address is provided, use the default if it exists.
*/
if (nam == NULL) {
if ((mp->mnt_flag & MNT_DEFEXPORTED) != 0)
return (&nep->ne_defexported);
return (NULL);
}
/*
* Lookup in the export list
*/
if (nam != NULL) {
saddr = nam;
rnh = NULL;
switch (saddr->sa_family) {
@ -487,6 +479,13 @@ vfs_export_lookup(struct mount *mp, struct sockaddr *nam)
if (np != NULL && (np->netc_rnodes->rn_flags & RNF_ROOT) != 0)
return (NULL);
}
}
/*
* If no address match, use the default if it exists.
*/
if (np == NULL && (mp->mnt_flag & MNT_DEFEXPORTED) != 0)
return (&nep->ne_defexported);
return (np);
}