Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Jun 2000 03:25:43 -0400 (EDT)
From:      Bosko Milekic <bmilekic@dsuper.net>
To:        Mike Silbersack <silby@silby.com>
Cc:        hackers@FreeBSD.ORG, jlemon@freebsd.org
Subject:   Re: Mbuf waiting mfc to 3
Message-ID:  <Pine.BSF.4.21.0006100306330.23301-200000@jehovah.technokratis.com>
In-Reply-To: <Pine.BSF.4.21.0006092012390.13026-100000@achilles.silby.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]

[re-directed to --hackers, as more appropriate there, also
jlemon@freebsd.org is in the CC, make _SURE_ to remove him from there
before you post ANY replies!!!]

 Mike, your patch looks fine. However, I found a bug in /sys/netkey code.
 (and it's related to the wait stuff, although I don't believe it directly
 concerns your patch so, as far as I'm concerned, your stuff is ready to go
 in.)

  However, I believe this code is only for 4.x and -CURRENT people.

 keysock.c's key_sendup() does a silly thing with the mbuf allocation.

 Attached is a patch that fixes it.

 This applies to v 1.2 of the file.
 here is the Id:
 /* KAME @(#)$Id: keysock.c,v 1.2 1999/08/16 19:30:36 shin Exp $ */
 
 (Jlemon, can you commit this?)

 Oh yeah, and please also commit pr=18471 as it's been sitting there for a
 while.

Thanks in advance,
Bosko.

On Fri, 9 Jun 2000, Mike Silbersack wrote:

> Well, it's been nearly a month since I posted the mbuf waiting MFC for 3.4
> to -net, although I haven't heard any complaints about it messing up
> systems, there have been a few complaints on bugtraq of mbuf
> exhaustion attacks which would be much less serious with it. :)
> 
> In any case, the patch is still available at
> http://www.silby.com/patches/mbuf-wait-mfc-2.patch for review.  I'm
> fairly confident in its reliability, but I'd prefer a few more people to
> test it if they have the time.  If there are no negative complaints, I'd
> like to get it committed before the end of next week to ensure that we
> don't miss getting it into 3.5.
> 
> There are no changes between this patch and the last one I posted other
> than a single version line I had messed up in the previous one, so if
> you're currently testing that one, there's no need to download this
> one.  Please post your experiences with it in any case, though.
> 
> The small memory leak I alluded to in my previous posting of the patch has
> been found and committed seperately (as it affected 3,4, and 5.)  So,
> please CVSUP before testing this patch to ensure you're seeing its true
> colors.
> 
> Thanks,
> 
> Mike "Silby" Silbersack


--
 Bosko Milekic  *  Voice/Mobile: 514.865.7738  *  Pager: 514.921.0237
    bmilekic@technokratis.com  *  http://www.technokratis.com/


[-- Attachment #2 --]
--- keysock.old.c	Sat Jun 10 03:09:05 2000
+++ keysock.c	Sat Jun 10 03:13:43 2000
@@ -419,18 +419,25 @@
 	while (tlen > 0) {
 		if (tlen == len) {
 			MGETHDR(n, M_DONTWAIT, MT_DATA);
+			if (n == NULL) {
+				if (m) m_freem(m);
+				return ENOBUFS;
+			}
 			n->m_len = MHLEN;
 		} else {
 			MGET(n, M_DONTWAIT, MT_DATA);
+			if (n == NULL) {
+				if (m) m_freem(m);
+				return ENOBUFS;
+			}
 			n->m_len = MLEN;
 		}
-		if (!n)
-			return ENOBUFS;
+
 		if (tlen > MCLBYTES) {	/*XXX better threshold? */
 			MCLGET(n, M_DONTWAIT);
 			if ((n->m_flags & M_EXT) == 0) {
 				m_free(n);
-				m_freem(m);
+				if (m) m_freem(m);
 				return ENOBUFS;
 			}
 			n->m_len = MCLBYTES;

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0006100306330.23301-200000>