Fix panic or hangup when "sysctl -w hw.ixgN.debug=1". trunk
authormsaitoh <msaitoh@NetBSD.org>
Mon, 14 May 2018 09:21:36 +0000
branchtrunk
changeset 319031 771e8e49ea9e
parent 319030 4a3420c8a6af
child 319032 39c9cdf4a9c9
Fix panic or hangup when "sysctl -w hw.ixgN.debug=1". XXX pullup-8
sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c	Mon May 14 06:52:33 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c	Mon May 14 09:21:36 2018 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.96 2018/05/08 09:45:54 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.97 2018/05/14 09:21:36 msaitoh Exp $*/
 
 /******************************************************************************
 
@@ -2639,21 +2639,18 @@
 static int
 ixv_sysctl_debug(SYSCTLFN_ARGS)
 {
-	struct sysctlnode node;
-	struct adapter *adapter;
+	struct sysctlnode node = *rnode;
+	struct adapter *adapter = (struct adapter *)node.sysctl_data;
 	int            error, result;
 
-	node = *rnode;
 	node.sysctl_data = &result;
 	error = sysctl_lookup(SYSCTLFN_CALL(&node));
 
 	if (error || newp == NULL)
 		return error;
 
-	if (result == 1) {
-		adapter = (struct adapter *)node.sysctl_data;
+	if (result == 1)
 		ixv_print_debug_info(adapter);
-	}
 
 	return 0;
 } /* ixv_sysctl_debug */