From owner-freebsd-current@FreeBSD.ORG Tue Jul 26 14:53:37 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CE70B16A41F; Tue, 26 Jul 2005 14:53:37 +0000 (GMT) (envelope-from rodrigc@crodrigues.org) Received: from rwcrmhc12.comcast.net (rwcrmhc14.comcast.net [216.148.227.89]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6B15E43D46; Tue, 26 Jul 2005 14:53:37 +0000 (GMT) (envelope-from rodrigc@crodrigues.org) Received: from c-66-30-114-143.hsd1.ma.comcast.net ([66.30.114.143]) by comcast.net (rwcrmhc14) with ESMTP id <20050726145336014001lgphe>; Tue, 26 Jul 2005 14:53:36 +0000 Received: from c-66-30-114-143.hsd1.ma.comcast.net (localhost.127.in-addr.arpa [127.0.0.1]) by c-66-30-114-143.hsd1.ma.comcast.net (8.13.4/8.13.1) with ESMTP id j6QErYFQ001845; Tue, 26 Jul 2005 10:53:35 -0400 (EDT) (envelope-from rodrigc@c-66-30-114-143.hsd1.ma.comcast.net) Received: (from rodrigc@localhost) by c-66-30-114-143.hsd1.ma.comcast.net (8.13.4/8.13.1/Submit) id j6QErYOl001844; Tue, 26 Jul 2005 10:53:34 -0400 (EDT) (envelope-from rodrigc) Date: Tue, 26 Jul 2005 10:53:34 -0400 From: Craig Rodrigues To: rwatson@freebsd.org Message-ID: <20050726145334.GA1826@crodrigues.org> References: <20050726124222.GA1109@crodrigues.org> <20050726131712.GC46538@darkness.comp.waw.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050726131712.GC46538@darkness.comp.waw.pl> User-Agent: Mutt/1.5.9i Cc: freebsd-current@freebsd.org, Harti Brandt Subject: Re: Panic in netnatm X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jul 2005 14:53:37 -0000 On Tue, Jul 26, 2005 at 03:17:12PM +0200, Pawel Jakub Dawidek wrote: > +> panic: mutex natm_mtx not owned at /usr/src/sys/netnatm/natm_pcb.c:110 > > Trace will probably not be needed, as there are only two places where > npcb_add() is called. > It looks like NATM locking is missing in /sys/netinet/if_atm.c. Ahh, thanks Pawel! You saved me some time. It looks like locks must be held before npcb_free() and npcb_add() are called. It looks like Harti is on vacation, so can you help Robert? Is something like this needed? --- if_atm.c.orig Tue Jul 26 10:28:42 2005 +++ if_atm.c Tue Jul 26 10:37:28 2005 @@ -224,11 +224,15 @@ sin = (struct sockaddr_in *) rt_key(rt); if (sin->sin_family != AF_INET) goto failed; + NATM_LOCK(); npcb = npcb_add(NULL, rt->rt_ifp, op.param.vci, op.param.vpi); - if (npcb == NULL) + if (npcb == NULL) { + NATM_UNLOCK(); goto failed; + } npcb->npcb_flags |= NPCB_IP; npcb->ipaddr.s_addr = sin->sin_addr.s_addr; + NATM_UNLOCK(); /* XXX: move npcb to llinfo when ATM ARP is ready */ rt->rt_llinfo = (caddr_t) npcb; rt->rt_flags |= RTF_LLINFO; @@ -252,9 +256,11 @@ failed: #ifdef NATM if (npcb) { + NATM_LOCK(); npcb_free(npcb, NPCB_DESTROY); rt->rt_llinfo = NULL; rt->rt_flags &= ~RTF_LLINFO; + NATM_UNLOCK(); } #endif /* mark as invalid. We cannot RTM_DELETE the route from @@ -269,10 +275,12 @@ * tell native ATM we are done with this VC */ if (rt->rt_flags & RTF_LLINFO) { + NATM_LOCK(); npcb_free((struct natmpcb *)rt->rt_llinfo, NPCB_DESTROY); rt->rt_llinfo = NULL; rt->rt_flags &= ~RTF_LLINFO; + NATM_UNLOCK(); } #endif /* -- Craig Rodrigues rodrigc@crodrigues.org