Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Aug 2003 15:52:46 -0400 (EDT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Pawel Malachowski <pawmal-posting@freebsd.lublin.pl>
Cc:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   Re: kern/55886: mbuf exhaustion can cause panic
Message-ID:  <Pine.NEB.3.96L.1030825155029.5347F-100000@fledge.watson.org>
In-Reply-To: <20030823005046.5FBDE5F103@shellma.zin.lublin.pl>

next in thread | previous in thread | raw e-mail | index | archive | help
Try the attached patch for -CURRENT, or variation on -STABLE.  Basically,
M_PREPEND() can fail leaving (m == NULL) even with M_TRYWAIT.  Most
consumers of M_PREPEND seem to know that.  Raw IP output seems not to.

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert@fledge.watson.org      Network Associates Laboratories

Index: raw_ip.c
===================================================================
RCS file: /data/fbsd-cvs/ncvs/src/sys/netinet/raw_ip.c,v
retrieving revision 1.114
diff -u -r1.114 raw_ip.c
--- raw_ip.c	20 Aug 2003 14:46:40 -0000	1.114
+++ raw_ip.c	25 Aug 2003 19:50:07 -0000
@@ -288,6 +288,8 @@
 			return(EMSGSIZE);
 		}
 		M_PREPEND(m, sizeof(struct ip), M_TRYWAIT);
+		if (m == NULL)
+			return(ENOBUFS);
 		ip = mtod(m, struct ip *);
 		ip->ip_tos = inp->inp_ip_tos;
 		ip->ip_off = 0;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1030825155029.5347F-100000>