Panic in netnatm
Craig Rodrigues
rodrigc at crodrigues.org
Fri Jul 29 04:42:19 GMT 2005
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
/*
More information about the freebsd-current
mailing list