Date: Fri, 9 Mar 2001 13:35:10 +0200 (SAT) From: John Hay <jhay@icomtek.csir.co.za> To: itojun@iijlab.net Cc: bmilekic@technokratis.com, freebsd-net@FreeBSD.ORG Subject: Re: kernel: nd6_storelladdr failed, mbuf leak Message-ID: <200103091135.f29BZA959543@zibbi.icomtek.csir.co.za> In-Reply-To: <26821.984121907@coconut.itojun.org> from "itojun@iijlab.net" at "Mar 9, 2001 04:11:47 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
> > >I'll do it right now if itojun doesn't mind (to save him a task :-) ) > >and get authorization from Jordan to commit. > > please go ahead, i can review the diff if you want me to. > Ok, here is a patch for -current. It was taken from the kame code with minor adjustments to fit into our tree. I have tested it on -current, but not on -stable yet. Itojun will you look it over please? I'm gone for the weekend now, so I'll only be able to commit it by Sunday night. If someone wants to do it before then, you're welcome. John -- John Hay -- John.Hay@icomtek.csir.co.za Index: sys/net/if_ethersubr.c =================================================================== RCS file: /home/ncvs/src/sys/net/if_ethersubr.c,v retrieving revision 1.91 diff -u -r1.91 if_ethersubr.c --- sys/net/if_ethersubr.c 2001/02/18 17:54:52 1.91 +++ sys/net/if_ethersubr.c 2001/03/09 11:00:49 @@ -184,8 +184,7 @@ #ifdef INET6 case AF_INET6: if (!nd6_storelladdr(&ac->ac_if, rt, m, dst, (u_char *)edst)) { - /* this must be impossible, so we bark */ - printf("nd6_storelladdr failed\n"); + /* something bad happened */ return(0); } off = m->m_pkthdr.len - m->m_len; Index: sys/net/if_fddisubr.c =================================================================== RCS file: /home/ncvs/src/sys/net/if_fddisubr.c,v retrieving revision 1.49 diff -u -r1.49 if_fddisubr.c --- sys/net/if_fddisubr.c 2001/02/04 13:12:56 1.49 +++ sys/net/if_fddisubr.c 2001/03/09 11:01:18 @@ -180,8 +180,7 @@ #ifdef INET6 case AF_INET6: if (!nd6_storelladdr(&ac->ac_if, rt, m, dst, (u_char *)edst)) { - /* this must be impossible, so we bark */ - printf("nd6_storelladdr failed\n"); + /* something bad happened */ return(0); } type = htons(ETHERTYPE_IPV6); Index: sys/netinet6/nd6.c =================================================================== RCS file: /home/ncvs/src/sys/netinet6/nd6.c,v retrieving revision 1.7 diff -u -r1.7 nd6.c --- sys/netinet6/nd6.c 2001/02/26 03:41:13 1.7 +++ sys/netinet6/nd6.c 2001/03/09 10:20:04 @@ -970,6 +970,7 @@ return(1); break; default: + m_freem(m); return(0); } } @@ -1026,6 +1027,7 @@ ln, 0); } } + /* do not free mbuf here, it is queued into llinfo_nd6 */ return(0); } #endif /* OLDIP6OUTPUT */ @@ -1981,19 +1983,26 @@ *desten = 0; return(1); default: + m_freem(m); return(0); } } - if (rt == NULL || - rt->rt_gateway->sa_family != AF_LINK) { + if (rt == NULL) { + /* this could happen, if we could not allocate memory */ + m_freem(m); + return(0); + } + if (rt->rt_gateway->sa_family != AF_LINK) { printf("nd6_storelladdr: something odd happens\n"); + m_freem(m); return(0); } sdl = SDL(rt->rt_gateway); if (sdl->sdl_alen == 0) { /* this should be impossible, but we bark here for debugging */ printf("nd6_storelladdr: sdl_alen == 0\n"); + m_freem(m); return(0); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200103091135.f29BZA959543>