Author: trociny
Date: Tue Jun 10 18:21:37 2014
New Revision: 267336
URL: http://svnweb.freebsd.org/changeset/base/267336

Log:
  PF_BLUETOOTH protocols: skip initialization of non-virtualized globals
  for non-default VNET instances.
  
  This fixes panic on a vnet initialization when ng_btsocket is loaded.
  
  MFC after:    1 week

Modified:
  head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c
  head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
  head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c
  head/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
  head/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c

Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c
==============================================================================
--- head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c    Tue Jun 10 
17:54:24 2014        (r267335)
+++ head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c    Tue Jun 10 
18:21:37 2014        (r267336)
@@ -51,6 +51,9 @@
 #include <sys/socketvar.h>
 #include <sys/sysctl.h>
 #include <sys/taskqueue.h>
+
+#include <net/vnet.h>
+
 #include <netgraph/ng_message.h>
 #include <netgraph/netgraph.h>
 #include <netgraph/bluetooth/include/ng_bluetooth.h>
@@ -728,6 +731,10 @@ ng_btsocket_hci_raw_init(void)
        bitstr_t        *f = NULL;
        int              error = 0;
 
+       /* Skip initialization of globals for non-default instances. */
+       if (!IS_DEFAULT_VNET(curvnet))
+               return;
+
        ng_btsocket_hci_raw_node = NULL;
        ng_btsocket_hci_raw_debug_level = NG_BTSOCKET_WARN_LEVEL;
        ng_btsocket_hci_raw_ioctl_timeout = 5;

Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
==============================================================================
--- head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c      Tue Jun 10 
17:54:24 2014        (r267335)
+++ head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c      Tue Jun 10 
18:21:37 2014        (r267336)
@@ -1813,6 +1813,10 @@ ng_btsocket_l2cap_init(void)
 {
        int     error = 0;
 
+       /* Skip initialization of globals for non-default instances. */
+       if (!IS_DEFAULT_VNET(curvnet))
+               return;
+
        ng_btsocket_l2cap_node = NULL;
        ng_btsocket_l2cap_debug_level = NG_BTSOCKET_WARN_LEVEL;
 

Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c
==============================================================================
--- head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c  Tue Jun 10 
17:54:24 2014        (r267335)
+++ head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c  Tue Jun 10 
18:21:37 2014        (r267336)
@@ -50,6 +50,9 @@
 #include <sys/socketvar.h>
 #include <sys/sysctl.h>
 #include <sys/taskqueue.h>
+
+#include <net/vnet.h>
+
 #include <netgraph/ng_message.h>
 #include <netgraph/netgraph.h>
 #include <netgraph/bluetooth/include/ng_bluetooth.h>
@@ -513,6 +516,10 @@ ng_btsocket_l2cap_raw_init(void)
 {
        int     error = 0;
 
+       /* Skip initialization of globals for non-default instances. */
+       if (!IS_DEFAULT_VNET(curvnet))
+               return;
+
        ng_btsocket_l2cap_raw_node = NULL;
        ng_btsocket_l2cap_raw_debug_level = NG_BTSOCKET_WARN_LEVEL;
        ng_btsocket_l2cap_raw_ioctl_timeout = 5;

Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
==============================================================================
--- head/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c     Tue Jun 10 
17:54:24 2014        (r267335)
+++ head/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c     Tue Jun 10 
18:21:37 2014        (r267336)
@@ -328,6 +328,11 @@ ng_btsocket_rfcomm_check_fcs(u_int8_t *d
 void
 ng_btsocket_rfcomm_init(void)
 {
+
+       /* Skip initialization of globals for non-default instances. */
+       if (!IS_DEFAULT_VNET(curvnet))
+               return;
+
        ng_btsocket_rfcomm_debug_level = NG_BTSOCKET_WARN_LEVEL;
        ng_btsocket_rfcomm_timo = 60;
 

Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
==============================================================================
--- head/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c        Tue Jun 10 
17:54:24 2014        (r267335)
+++ head/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c        Tue Jun 10 
18:21:37 2014        (r267336)
@@ -1107,6 +1107,10 @@ ng_btsocket_sco_init(void)
 {
        int     error = 0;
 
+       /* Skip initialization of globals for non-default instances. */
+       if (!IS_DEFAULT_VNET(curvnet))
+               return;
+
        ng_btsocket_sco_node = NULL;
        ng_btsocket_sco_debug_level = NG_BTSOCKET_WARN_LEVEL;
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to