kern/55886: mbuf exhaustion can cause panic

Robert Watson rwatson at FreeBSD.org
Mon Aug 25 13:00:43 PDT 2003


The following reply was made to PR kern/55886; it has been noted by GNATS.

From: Robert Watson <rwatson at FreeBSD.org>
To: Pawel Malachowski <pawmal-posting at freebsd.lublin.pl>
Cc: FreeBSD-gnats-submit at FreeBSD.org, freebsd-bugs at FreeBSD.org
Subject: Re: kern/55886: mbuf exhaustion can cause panic
Date: Mon, 25 Aug 2003 15:52:46 -0400 (EDT)

 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 at 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;
 


More information about the freebsd-bugs mailing list