NetBSD Problem Report #27678
From chuck@xxx.pdl.cmu.edu Sat Oct 30 02:37:48 2004
Return-Path: <chuck@xxx.pdl.cmu.edu>
Received: from xxx.pdl.cmu.edu (XXX.PDL.CMU.EDU [128.2.134.93])
by narn.netbsd.org (Postfix) with ESMTP id 4BD01251EB8
for <gnats-bugs@gnats.NetBSD.org>; Sat, 30 Oct 2004 02:37:48 +0000 (UTC)
Message-Id: <200410300235.i9U2Ztub025724@xxx.pdl.cmu.edu>
Date: Fri, 29 Oct 2004 22:35:55 -0400 (EDT)
From: chuck@ece.cmu.edu
Reply-To: chuck@ece.cmu.edu
To: gnats-bugs@gnats.NetBSD.org
Subject: destroying if_wm.c vlans with ifconfig can crash system
X-Send-Pr-Version: 3.95
>Number: 27678
>Category: kern
>Synopsis: destroying if_wm.c vlans with ifconfig can crash system
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Oct 30 02:38:00 +0000 2004
>Closed-Date: Sun Oct 31 00:05:03 +0000 2004
>Last-Modified: Wed Apr 06 17:13:01 +0000 2005
>Originator: Chuck Cranor
>Release: NetBSD 2.0_RC4
>Organization:
Carnegie Mellon University
>Environment:
System: NetBSD bum.pdl.cmu.edu 2.0_RC4 NetBSD 2.0_RC4 (GENERIC) #5: Thu Oct 28 22:03:22 UTC 2004 isildur@bum.pdl.cmu.edu:/home/netbsd/20/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
we have a 2.0_RC4 system with a wm0 ethernet interface that is
connected to a switch with 2 vlans (vlan0, vlan1). the wm0
interface is configured as "up" in /etc/rc.conf, and the vlan0
and vlan1 interfaces are configured using /etc/ifconfig.vlan{0,1}.
with this config, running "/etc/rc.d/network stop" crashes the
system. this is because the script does "ifconfig wm0 down"
before unconfiguring the vlan interfaces.
when the script attempts to "ifconfig <vlan> destroy" the final
vlan associated with wm0 (which is already shut down), the following
call stack occurs:
if_clone_destroy
-> vlan_clone_destroy
-> vlan_unconfig
-> vlan_ether_purgemulti
-> wm_ioctl /* command == SIOCDELMULTI */
wm_ioctl() has the following code:
error = ether_ioctl(ifp, cmd, data);
if (error == ENETRESET) {
/*
* Multicast list has changed; set the hardware filter
* accordingly.
*/
wm_set_filter(sc);
error = 0;
}
this code results in 'wm_set_filter(sc)' for wm0 getting called,
even though the wm0 interface is already down (!RUNNING).
unfortunately, the wm_set_filter() call enables receive interrupts
on wm0 even though the interface is down. when the first receive
interrupt occurs, it tries to do mbuf operations without having
any receive ring allocated (again, because the interface is supposed
to be down).
this results in a reference though a NULL mbuf pointer and a
kernel panic.
>How-To-Repeat:
configure up a wm0, vlan0, vlan1. running the following commands
(this is what '/etc/rc.d/network stop' does):
ifconfig wm0 down
ifconfig wm0 destroy
ifconfig vlan1 down
ifconfig vlan1 destroy
ifconfig vlan0 down
ifconfig vlan0 destroy
the system will panic after the final destroy command as soon
as a receive interrupt occurs.
>Fix:
do not call wm_set_filter() on interfaces that are not IFF_RUNNING.
the hardware should be reset and multicast filters set if/when the
interface is brought up.
note that other network interface drivers besides if_wm.c should
be inspected for this problem.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: thorpej
State-Changed-When: Sun Oct 31 00:04:46 UTC 2004
State-Changed-Why:
Fixed in -current. Pullups requested for 2.0 branch.
From: Havard Eidnes <he@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: PR/27678 CVS commit: [netbsd-2-0] src/sys/arch/sgimips/hpc
Date: Wed, 6 Apr 2005 17:12:07 +0000 (UTC)
Module Name: src
Committed By: he
Date: Wed Apr 6 17:12:07 UTC 2005
Modified Files:
src/sys/arch/sgimips/hpc [netbsd-2-0]: if_sq.c
Log Message:
Pull up revision 1.21 (requested by thorpej in ticket #939):
When adding or deleting multicast addresses, only change
the address filter if the interface is marked RUNNING.
Fixes PR#27678.
Dragged along for the benefit of ticket #1054 which will be committed shortly.
To generate a diff of this commit:
cvs rdiff -r1.20 -r1.20.2.1 src/sys/arch/sgimips/hpc/if_sq.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
>Quarter:
>Keywords:
>Date-Required:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.