summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/safe.c
diff options
context:
space:
mode:
authorblambert <blambert@openbsd.org>2011-04-05 11:48:28 +0000
committerblambert <blambert@openbsd.org>2011-04-05 11:48:28 +0000
commit7fbb3004a7e1024422b385c8d7d8106f87afccd1 (patch)
tree09c5aba0422e85787fa007bda2b716b844a967a8 /sys/dev/pci/safe.c
parentQuote $daemon_flags to prevent echo(1) picking them as input flags. (diff)
downloadwireguard-openbsd-7fbb3004a7e1024422b385c8d7d8106f87afccd1.tar.xz
wireguard-openbsd-7fbb3004a7e1024422b385c8d7d8106f87afccd1.zip
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/safe.c')
-rw-r--r--sys/dev/pci/safe.c5
1 files changed, 3 insertions, 2 deletions
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;