diff options
author | Bret Lambert <blambert@cvs.openbsd.org> | 2011-04-05 11:48:29 +0000 |
---|---|---|
committer | Bret Lambert <blambert@cvs.openbsd.org> | 2011-04-05 11:48:29 +0000 |
commit | 94443e3a8469c3b4270194ffd9a06c03702ce903 (patch) | |
tree | a3ac085f92f3f31be825d2ee4b46a3cc2dda8a61 /sys/net80211/ieee80211_crypto_wep.c | |
parent | a5b5f8337f372b5773fb995fbbf744d56eb5e396 (diff) |
Passing M_WAITOK to mbuf functions is supposed to be a contract between
the caller and the function that the function will not fail to allocate
memory and return a NULL pointer. However, m_dup_pkthdr() violates
this contract, making it possible for functions that pass M_WAITOK to
be surprised in ways that hurt.
Fix this by passing the wait flag all the way down the functions that
actually do the allocation for m_dup_pkthdr() so that we won't be
surprised.
man page update forthcoming
ok claudio@
Diffstat (limited to 'sys/net80211/ieee80211_crypto_wep.c')
-rw-r--r-- | sys/net80211/ieee80211_crypto_wep.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/net80211/ieee80211_crypto_wep.c b/sys/net80211/ieee80211_crypto_wep.c index 178c10c2890..39712b87255 100644 --- a/sys/net80211/ieee80211_crypto_wep.c +++ b/sys/net80211/ieee80211_crypto_wep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_crypto_wep.c,v 1.7 2009/09/24 16:03:10 damien Exp $ */ +/* $OpenBSD: ieee80211_crypto_wep.c,v 1.8 2011/04/05 11:48:28 blambert Exp $ */ /*- * Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr> @@ -95,7 +95,7 @@ ieee80211_wep_encrypt(struct ieee80211com *ic, struct mbuf *m0, MGET(n0, M_DONTWAIT, m0->m_type); if (n0 == NULL) goto nospace; - if (m_dup_pkthdr(n0, m0)) + if (m_dup_pkthdr(n0, m0, M_DONTWAIT)) goto nospace; n0->m_pkthdr.len += IEEE80211_WEP_HDRLEN; n0->m_len = MHLEN; @@ -228,7 +228,7 @@ ieee80211_wep_decrypt(struct ieee80211com *ic, struct mbuf *m0, MGET(n0, M_DONTWAIT, m0->m_type); if (n0 == NULL) goto nospace; - if (m_dup_pkthdr(n0, m0)) + if (m_dup_pkthdr(n0, m0, M_DONTWAIT)) goto nospace; n0->m_pkthdr.len -= IEEE80211_WEP_TOTLEN; n0->m_len = MHLEN; |