summaryrefslogtreecommitdiff
path: root/sys/dev/pci/hifn7751.c
diff options
context:
space:
mode:
authorBret Lambert <blambert@cvs.openbsd.org>2011-04-05 11:48:29 +0000
committerBret Lambert <blambert@cvs.openbsd.org>2011-04-05 11:48:29 +0000
commit94443e3a8469c3b4270194ffd9a06c03702ce903 (patch)
treea3ac085f92f3f31be825d2ee4b46a3cc2dda8a61 /sys/dev/pci/hifn7751.c
parenta5b5f8337f372b5773fb995fbbf744d56eb5e396 (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/dev/pci/hifn7751.c')
-rw-r--r--sys/dev/pci/hifn7751.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c
index aa64a03f767..c2143f0f5e5 100644
--- a/sys/dev/pci/hifn7751.c
+++ b/sys/dev/pci/hifn7751.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hifn7751.c,v 1.165 2011/04/03 15:36:02 jasper Exp $ */
+/* $OpenBSD: hifn7751.c,v 1.166 2011/04/05 11:48:28 blambert Exp $ */
/*
* Invertex AEON / Hifn 7751 driver
@@ -1430,7 +1430,8 @@ hifn_crypto(struct hifn_softc *sc, struct hifn_command *cmd,
goto err_srcmap;
}
if (len == MHLEN) {
- err = m_dup_pkthdr(m0, cmd->srcu.src_m);
+ err = m_dup_pkthdr(m0, cmd->srcu.src_m,
+ M_DONTWAIT);
if (err) {
m_free(m0);
goto err_srcmap;
@@ -2739,7 +2740,7 @@ hifn_mkmbuf_chain(int totlen, struct mbuf *mtemplate)
if (m0 == NULL)
return (NULL);
if (len == MHLEN) {
- if (m_dup_pkthdr(m0, mtemplate)) {
+ if (m_dup_pkthdr(m0, mtemplate, M_DONTWAIT)) {
m_free(m0);
return (NULL);
}