summaryrefslogtreecommitdiffstats
path: root/sys/netinet/raw_ip.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2003-08-26 14:11:48 +0000
committerrwatson <rwatson@FreeBSD.org>2003-08-26 14:11:48 +0000
commitbfe66075cf6940f2c1e9a0297cf821651a24a70d (patch)
tree6f3d9c16a6f7ca69d0b15565a84c0ae82c4fcd29 /sys/netinet/raw_ip.c
parent05b6d7c95ac193c44a7cbc5f1e2a89939a1fc2c4 (diff)
downloadFreeBSD-src-bfe66075cf6940f2c1e9a0297cf821651a24a70d.zip
FreeBSD-src-bfe66075cf6940f2c1e9a0297cf821651a24a70d.tar.gz
M_PREPEND() with an argument of M_TRYWAIT can fail, meaning the
returned mbuf can be NULL. Check for NULL in rip_output() when prepending an IP header. This prevents mbuf exhaustion from causing a local kernel panic when sending raw IP packets. PR: kern/55886 Reported by: Pawel Malachowski <pawmal-posting@freebsd.lublin.pl> MFC after: 3 days
Diffstat (limited to 'sys/netinet/raw_ip.c')
-rw-r--r--sys/netinet/raw_ip.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index d4766ab..6e60033 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -288,6 +288,8 @@ rip_output(m, so, dst)
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;
OpenPOWER on IntegriCloud