Date: Fri, 12 Jul 2013 11:25:15 -0700 From: Adrian Chadd <adrian@freebsd.org> To: Craig Rodrigues <rodrigc@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r253255 - head/sys/netgraph/bluetooth/drivers/ubt Message-ID: <CAJ-VmonR5n8qZ5wuRtvfu0BSg9sTdt09b9cr-mOtYXHVeJhS%2BQ@mail.gmail.com> In-Reply-To: <CAJ-Vmonrmgr3HJRzQtVmWp=8SkpSeWNVeBZgOnSnE72NNp=3DQ@mail.gmail.com> References: <201307120803.r6C83ACp016523@svn.freebsd.org> <CAJ-Vmonrmgr3HJRzQtVmWp=8SkpSeWNVeBZgOnSnE72NNp=3DQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
.. oh, and this particular patch is for destroying netgraph nodes, not just upon attach. -adrian On 12 July 2013 11:24, Adrian Chadd <adrian@freebsd.org> wrote: > Hm, I just found a patch in my local collection which works for all > netgraph nodes. > > Maybe we should do that instead of this? > > http://people.freebsd.org/~adrian/ath/20130712-netgraph-vimage.diff > > That should solve it for all dynamic netgraph stuff, rather than just bluetooth. > > > > -adrian > > On 12 July 2013 01:03, Craig Rodrigues <rodrigc@freebsd.org> wrote: >> Author: rodrigc >> Date: Fri Jul 12 08:03:10 2013 >> New Revision: 253255 >> URL: http://svnweb.freebsd.org/changeset/base/253255 >> >> Log: >> PR: kern/168520 >> Submitted by: "YAMAMOTO, Shigeru" <shigeru@iij.ad.jp> >> 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. >> >> Modified: >> head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c >> >> Modified: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c >> ============================================================================== >> --- head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Fri Jul 12 07:43:56 2013 (r253254) >> +++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Fri Jul 12 08:03:10 2013 (r253255) >> @@ -109,7 +109,9 @@ >> #include <sys/unistd.h> >> #include <sys/callout.h> >> #include <sys/malloc.h> >> +#include <sys/jail.h> >> #include <sys/priv.h> >> +#include <sys/proc.h> >> >> #include "usbdevs.h" >> #include <dev/usb/usb.h> >> @@ -123,6 +125,7 @@ >> #include <sys/mbuf.h> >> #include <sys/taskqueue.h> >> >> +#include <net/vnet.h> >> #include <netgraph/ng_message.h> >> #include <netgraph/netgraph.h> >> #include <netgraph/ng_parse.h> >> @@ -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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-VmonR5n8qZ5wuRtvfu0BSg9sTdt09b9cr-mOtYXHVeJhS%2BQ>