diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2007-07-03 16:03:49 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2007-07-03 16:03:49 +0000 |
commit | 7631563f2e950e4a04d1699639a06efb3cf3d5fb (patch) | |
tree | 93ce6652fea2a7b6abd6e65d79c6e3531d30cd44 /sys/net80211 | |
parent | 815069a95484de30da9fe7da56c3d9c3cfb3adf0 (diff) |
In ieee80211_getmbuf(), if we need to allocate a mbuf cluster because
the length is greater than MHLEN, test that the allocation succeeded.
Otherwise, free the mbuf header and return NULL.
Callers assume that if the function returns a value != NULL then
enough space has been allocated.
Diffstat (limited to 'sys/net80211')
-rw-r--r-- | sys/net80211/ieee80211_output.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index 69be6b67aa3..ce7c745176c 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_output.c,v 1.33 2007/07/03 16:00:07 damien Exp $ */ +/* $OpenBSD: ieee80211_output.c,v 1.34 2007/07/03 16:03:48 damien Exp $ */ /* $NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung Exp $ */ /*- @@ -749,8 +749,11 @@ ieee80211_getmbuf(int flags, int type, u_int pktlen) if (pktlen > MCLBYTES) panic("802.11 packet too large: %u", pktlen); MGETHDR(m, flags, type); - if (m != NULL && pktlen > MHLEN) + if (m != NULL && pktlen > MHLEN) { MCLGET(m, flags); + if (!(m->m_flags & M_EXT)) + m = m_free(m); + } return m; } |