summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorzec <zec@FreeBSD.org>2009-08-28 22:51:07 +0000
committerzec <zec@FreeBSD.org>2009-08-28 22:51:07 +0000
commite9ba936d598c3f45391395094bc23319e1ddd1d6 (patch)
treead00400e7601031e7625369a588a07de6ae5e556 /sys/compat
parent0bf6e8da4eba6a1fb35ec2e5b2db62e53fec7d32 (diff)
downloadFreeBSD-src-e9ba936d598c3f45391395094bc23319e1ddd1d6.zip
FreeBSD-src-e9ba936d598c3f45391395094bc23319e1ddd1d6.tar.gz
Fix a few panics in linuxulator + VIMAGE due to curvnet not being set.
This change affects only options VIMAGE builds. Reviewed by: julian MFC after: 3 days
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linprocfs/linprocfs.c2
-rw-r--r--sys/compat/linux/linux_ioctl.c9
2 files changed, 10 insertions, 1 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
index dfa80d5..541db2f 100644
--- a/sys/compat/linprocfs/linprocfs.c
+++ b/sys/compat/linprocfs/linprocfs.c
@@ -1085,6 +1085,7 @@ linprocfs_donetdev(PFS_FILL_ARGS)
"bytes packets errs drop fifo frame compressed",
"bytes packets errs drop fifo frame compressed");
+ CURVNET_SET(TD_TO_VNET(curthread));
IFNET_RLOCK();
TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
linux_ifname(ifp, ifname, sizeof ifname);
@@ -1095,6 +1096,7 @@ linprocfs_donetdev(PFS_FILL_ARGS)
0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL);
}
IFNET_RUNLOCK();
+ CURVNET_RESTORE();
return (0);
}
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
index 03ac334..8acc592 100644
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -2104,6 +2104,7 @@ ifname_linux_to_bsd(struct thread *td, const char *lxname, char *bsdname)
return (NULL);
index = 0;
is_eth = (len == 3 && !strncmp(lxname, "eth", len)) ? 1 : 0;
+ CURVNET_SET(TD_TO_VNET(td));
IFNET_RLOCK();
TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
/*
@@ -2117,6 +2118,7 @@ ifname_linux_to_bsd(struct thread *td, const char *lxname, char *bsdname)
break;
}
IFNET_RUNLOCK();
+ CURVNET_RESTORE();
if (ifp != NULL)
strlcpy(bsdname, ifp->if_xname, IFNAMSIZ);
return (ifp);
@@ -2146,6 +2148,7 @@ linux_ifconf(struct thread *td, struct ifconf *uifc)
max_len = MAXPHYS - 1;
+ CURVNET_SET(TD_TO_VNET(td));
/* handle the 'request buffer size' case */
if (ifc.ifc_buf == PTROUT(NULL)) {
ifc.ifc_len = 0;
@@ -2157,11 +2160,14 @@ linux_ifconf(struct thread *td, struct ifconf *uifc)
}
}
error = copyout(&ifc, uifc, sizeof(ifc));
+ CURVNET_RESTORE();
return (error);
}
- if (ifc.ifc_len <= 0)
+ if (ifc.ifc_len <= 0) {
+ CURVNET_RESTORE();
return (EINVAL);
+ }
again:
/* Keep track of eth interfaces */
@@ -2223,6 +2229,7 @@ again:
memcpy(PTRIN(ifc.ifc_buf), sbuf_data(sb), ifc.ifc_len);
error = copyout(&ifc, uifc, sizeof(ifc));
sbuf_delete(sb);
+ CURVNET_RESTORE();
return (error);
}
OpenPOWER on IntegriCloud