summaryrefslogtreecommitdiff
path: root/sys/dev
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
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')
-rw-r--r--sys/dev/pci/hifn7751.c7
-rw-r--r--sys/dev/pci/safe.c5
-rw-r--r--sys/dev/pci/ubsec.c5
3 files changed, 10 insertions, 7 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);
}
diff --git a/sys/dev/pci/safe.c b/sys/dev/pci/safe.c
index 511d1a72a0d..436caa04ac0 100644
--- a/sys/dev/pci/safe.c
+++ b/sys/dev/pci/safe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: safe.c,v 1.32 2011/04/03 15:36:03 jasper Exp $ */
+/* $OpenBSD: safe.c,v 1.33 2011/04/05 11:48:28 blambert Exp $ */
/*-
* Copyright (c) 2003 Sam Leffler, Errno Consulting
@@ -807,7 +807,8 @@ safe_process(struct cryptop *crp)
goto errout;
}
if (len == MHLEN) {
- err = m_dup_pkthdr(m, re->re_src_m);
+ err = m_dup_pkthdr(m, re->re_src_m,
+ M_DONTWAIT);
if (err) {
m_free(m);
goto errout;
diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c
index a1958fa2b77..9e2402e1185 100644
--- a/sys/dev/pci/ubsec.c
+++ b/sys/dev/pci/ubsec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ubsec.c,v 1.151 2011/04/03 15:36:03 jasper Exp $ */
+/* $OpenBSD: ubsec.c,v 1.152 2011/04/05 11:48:28 blambert Exp $ */
/*
* Copyright (c) 2000 Jason L. Wright (jason@thought.net)
@@ -1153,7 +1153,8 @@ ubsec_process(struct cryptop *crp)
goto errout;
}
if (len == MHLEN) {
- err = m_dup_pkthdr(m, q->q_src_m);
+ err = m_dup_pkthdr(m, q->q_src_m,
+ M_DONTWAIT);
if (err) {
m_freem(m);
goto errout;