Module Name: src
Committed By: knakahara
Date: Thu Oct 19 07:02:00 UTC 2017
Modified Files:
src/sys/net: if_vlan.c
Log Message:
fix vlan panic when vlan is re-configured without destroy.
E.g. the following operation causes this panic.
====================
# ifconfig vlan0 create
# ifconfig vlan0 vlan 1 vlanif ixg3
# ifconfig vlan1 create
# ifconfig vlan1 vlan 1 vlanif ixg2
# ifconfig vlan1 -vlanif
# ifconfig vlan1 vlan 1 vlanif ixg2
panic: kernel diagnostic assertion "new->ple_next == NULL" failed: file
"/git/netbsd-src/sys/sys/pslist.h", line 118
====================
Pointed out and tested by [email protected], fixed by s-yamaguchi@IIJ, thanks.
XXX need pullup-8
To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/net/if_vlan.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.103 src/sys/net/if_vlan.c:1.104
--- src/sys/net/if_vlan.c:1.103 Thu Oct 12 02:40:59 2017
+++ src/sys/net/if_vlan.c Thu Oct 19 07:02:00 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vlan.c,v 1.103 2017/10/12 02:40:59 ozaki-r Exp $ */
+/* $NetBSD: if_vlan.c,v 1.104 2017/10/19 07:02:00 knakahara Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.103 2017/10/12 02:40:59 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.104 2017/10/19 07:02:00 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -478,6 +478,7 @@ vlan_config(struct ifvlan *ifv, struct i
*/
ifv->ifv_if.if_type = p->if_type;
+ PSLIST_ENTRY_INIT(ifv, ifv_hash);
idx = tag_hash_func(tag, ifv_hash.mask);
mutex_enter(&ifv_hash.lock);
@@ -582,6 +583,7 @@ vlan_unconfig_locked(struct ifvlan *ifv,
PSLIST_WRITER_REMOVE(ifv, ifv_hash);
pserialize_perform(vlan_psz);
mutex_exit(&ifv_hash.lock);
+ PSLIST_ENTRY_DESTROY(ifv, ifv_hash);
vlan_linkmib_update(ifv, nmib);