nfscl: Fix the NFSv4.0 mount so that it does not crash
Commit efe58855f3ea modifies IN_LOOPBACK() so that it uses a VNET variable. Without this patch, nfscl_getmyip() uses IN_LOOPBACK() when the VNET is not set and crashes the system. nfscl_getmyip() is only called when a NFSv4.0 (not NFSv4.1/4.2) mount is done. This patch re-organizes nfscl_getmyip() so that IN_LOOPBACK() is before the CURVENT_RESTORE() macro, to avoid the crashes. Reviewed by: karels, zlei.huang_gmail.com Differential Revision: https://reviews.freebsd.org/D37008
This commit is contained in:
parent
43f8c763cd
commit
7d9dc91a99
@ -1014,18 +1014,18 @@ nfscl_getmyip(struct nfsmount *nmp, struct in6_addr *paddr, int *isinet6p)
|
||||
NET_EPOCH_ENTER(et);
|
||||
CURVNET_SET(CRED_TO_VNET(nmp->nm_sockreq.nr_cred));
|
||||
nh = fib4_lookup(fibnum, sin->sin_addr, 0, NHR_NONE, 0);
|
||||
CURVNET_RESTORE();
|
||||
if (nh != NULL)
|
||||
if (nh != NULL) {
|
||||
addr = IA_SIN(ifatoia(nh->nh_ifa))->sin_addr;
|
||||
if (IN_LOOPBACK(ntohl(addr.s_addr))) {
|
||||
/* Ignore loopback addresses */
|
||||
nh = NULL;
|
||||
}
|
||||
}
|
||||
CURVNET_RESTORE();
|
||||
NET_EPOCH_EXIT(et);
|
||||
|
||||
if (nh == NULL)
|
||||
return (NULL);
|
||||
|
||||
if (IN_LOOPBACK(ntohl(addr.s_addr))) {
|
||||
/* Ignore loopback addresses */
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
*isinet6p = 0;
|
||||
*((struct in_addr *)paddr) = addr;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user