From nobody@FreeBSD.org  Sun Jul  3 09:54:39 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 9314816A41C
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  3 Jul 2005 09:54:39 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7F10F43D49
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  3 Jul 2005 09:54:39 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j639sc36019547
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 3 Jul 2005 09:54:39 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j639scs0019440;
	Sun, 3 Jul 2005 09:54:38 GMT
	(envelope-from nobody)
Message-Id: <200507030954.j639scs0019440@www.freebsd.org>
Date: Sun, 3 Jul 2005 09:54:38 GMT
From: LiangYi <liangyi571@hotmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Bridge configuration update will crash the system in 5.4
X-Send-Pr-Version: www-2.3

>Number:         82919
>Category:       kern
>Synopsis:       [if_bridge] [patch] Bridge configuration update will crash the system in 5.4
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    thompsa
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 03 10:00:32 GMT 2005
>Closed-Date:    
>Last-Modified:  Sun Oct 05 09:41:25 UTC 2008
>Originator:     LiangYi
>Release:        FreeBSD 5.4-RELEASE
>Organization:
lingzhou network Inc
>Environment:
FreeBSD bsd.lingzhou.com.cn 5.4-RELEASE FreeBSD 5.4-RELEASE #0
>Description:
Setup a bridge like this
	sysctl -w net.link.ether.bridge_cfg="em0:1,em1:1"
Generate some traffic on this bridge
Update the bridge configuration like this
	sysctl -w net.link.ether.bridge_cfg="em1:1,em2:1"
System will crash randomly.

>How-To-Repeat:

>Fix:
--- bridge.c.orig       Sun Jul  3 17:31:55 2005
+++ bridge.c    Sun Jul  3 17:33:17 2005
@@ -767,13 +767,19 @@
     struct ifnet *dst, *old;
     bdg_hash_table *bt;                        /* location in hash table */
     int dropit = BDG_MUTED(ifp);
+    struct cluster_softc *clp;
 
     /*
      * hash the source address
      */
     BDG_LOCK();
     index = HASH_FN(eh->ether_shost);
-    bt = &BDG_CLUSTER(ifp)->ht[index];
+    clp = BDG_CLUSTER(ifp);
+    if(clp==NULL) {
+       BDG_UNLOCK();
+       return BDG_DROP;
+    }
+    bt = &clp->ht[index];
     bt->used = 1;
     old = bt->name;
     if (old) {                         /* the entry is valid */

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->thompsa 
Responsible-Changed-By: remko 
Responsible-Changed-When: Sun Dec 9 14:20:16 UTC 2007 
Responsible-Changed-Why:  
Hello andrew, this could already be solved, but can you have a look 
anyway? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=82919 
>Unformatted:
