Author: trociny
Date: Mon Jun 30 19:46:17 2014
New Revision: 268061
URL: http://svnweb.freebsd.org/changeset/base/268061

Log:
  MFC r267336:
  
  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.

Modified:
  stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c
  stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
  stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c
  stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
  stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c
==============================================================================
--- stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c       Mon Jun 
30 19:36:08 2014        (r268060)
+++ stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c       Mon Jun 
30 19:46:17 2014        (r268061)
@@ -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: stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
==============================================================================
--- stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Mon Jun 30 
19:36:08 2014        (r268060)
+++ stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Mon Jun 30 
19:46:17 2014        (r268061)
@@ -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: stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c
==============================================================================
--- stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c     Mon Jun 
30 19:36:08 2014        (r268060)
+++ stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c     Mon Jun 
30 19:46:17 2014        (r268061)
@@ -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: stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
==============================================================================
--- stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c        Mon Jun 
30 19:36:08 2014        (r268060)
+++ stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c        Mon Jun 
30 19:46:17 2014        (r268061)
@@ -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: stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
==============================================================================
--- stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c   Mon Jun 30 
19:36:08 2014        (r268060)
+++ stable/10/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c   Mon Jun 30 
19:46:17 2014        (r268061)
@@ -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