Date: Fri, 29 Jul 2005 00:42:17 -0400 From: Craig Rodrigues <rodrigc@crodrigues.org> To: Robert Watson <rwatson@freebsd.org> Cc: freebsd-current@freebsd.org, Harti Brandt <harti@freebsd.org> Subject: Re: Panic in netnatm Message-ID: <20050729044217.GA16981@crodrigues.org> In-Reply-To: <20050727235142.F54330@fledge.watson.org> References: <20050726124222.GA1109@crodrigues.org> <20050726131712.GC46538@darkness.comp.waw.pl> <20050726145334.GA1826@crodrigues.org> <20050727223351.A54330@fledge.watson.org> <20050727214820.GA1123@crodrigues.org> <20050727235142.F54330@fledge.watson.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jul 27, 2005 at 11:53:07PM +0100, Robert Watson wrote: > I think you still need an NATM_UNLOCK() in the 'goto failed' case, > probably placed outside of the "if (npcb) {' block since it will need to > be unlocked in both cases. OK, how about this patch. In this case, for RTM_ADD, I only unlock things in the failed: block if npcb != NULL. If npcb == NULL, by the time we reach the failed: block, we should not be holding NATM_LOCK, so we do not unlock it there. Index: if_atm.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/if_atm.c,v retrieving revision 1.19 diff -u -u -r1.19 if_atm.c --- if_atm.c 7 Jan 2005 01:45:44 -0000 1.19 +++ if_atm.c 29 Jul 2005 04:37:50 -0000 @@ -224,9 +224,13 @@ 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; /* XXX: move npcb to llinfo when ATM ARP is ready */ @@ -255,6 +259,7 @@ 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 +274,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 /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050729044217.GA16981>