From d492e75fbda4134aac43b1cef4237817df2c8979 Mon Sep 17 00:00:00 2001 From: rodrigc Date: Fri, 12 Jul 2013 08:03:10 +0000 Subject: PR: kern/168520 Submitted by: "YAMAMOTO, Shigeru" Reviewed by: adrian In PC-BSD 9.1, VIMAGE is enabled in the kernel config. For laptops with Bluetooth capability, such as the HP Elitebook 8460p, the kernel will panic upon bootup, because curthread->td_vnet is not initialized. Properly initialize curthread->td_vnet when initializing the Bluetooth stack. This allows laptops such as the HP Elitebook 8460p laptop to properly boot with VIMAGE kernels. --- sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'sys/netgraph/bluetooth') diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c index b268409..402f958 100644 --- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c +++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c @@ -109,7 +109,9 @@ #include #include #include +#include #include +#include #include "usbdevs.h" #include @@ -123,6 +125,7 @@ #include #include +#include #include #include #include @@ -487,13 +490,14 @@ ubt_attach(device_t dev) sc->sc_dev = dev; sc->sc_debug = NG_UBT_WARN_LEVEL; - + CURVNET_SET(TD_TO_VNET(curthread)); /* * Create Netgraph node */ if (ng_make_node_common(&typestruct, &sc->sc_node) != 0) { UBT_ALERT(sc, "could not create Netgraph node\n"); + CURVNET_RESTORE(); return (ENXIO); } @@ -501,10 +505,12 @@ ubt_attach(device_t dev) if (ng_name_node(sc->sc_node, device_get_nameunit(dev)) != 0) { UBT_ALERT(sc, "could not name Netgraph node\n"); NG_NODE_UNREF(sc->sc_node); + CURVNET_RESTORE(); return (ENXIO); } NG_NODE_SET_PRIVATE(sc->sc_node, sc); NG_NODE_FORCE_WRITER(sc->sc_node); + CURVNET_RESTORE(); /* * Initialize device softc structure @@ -631,8 +637,10 @@ ubt_detach(device_t dev) /* Destroy Netgraph node */ if (node != NULL) { sc->sc_node = NULL; + CURVNET_SET(node->nd_vnet); NG_NODE_REALLY_DIE(node); ng_rmnode_self(node); + CURVNET_RESTORE(); } /* Make sure ubt_task in gone */ -- cgit v1.1