summaryrefslogtreecommitdiff
path: root/sys/dev/pci/ubsec.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2009-09-13 14:42:53 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2009-09-13 14:42:53 +0000
commit72c9514b3fe03e2af58b7386b4ea1b1b8d03bb73 (patch)
treeddd67747f9e94367b396ade568c730dfa795adb5 /sys/dev/pci/ubsec.c
parent4eef650080d9b8f29430c67e8bfb02019d822601 (diff)
M_DUP_PKTHDR() define -> m_dup_pkthdr() function to properly deal
with m_tag_copy_chain() failures. Use m_defrag() to eliminate hand rolled defragging of mbufs and some uses of M_DUP_PKTHDR(). Original diff from thib@, claudio@'s feedback integrated by me. Tests kevlo@ claudio@, "reads ok" blambert@ ok thib@ claudio@, "m_defrag() bits ok" kettenis@
Diffstat (limited to 'sys/dev/pci/ubsec.c')
-rw-r--r--sys/dev/pci/ubsec.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c
index a53469ce500..08ab6c98db9 100644
--- a/sys/dev/pci/ubsec.c
+++ b/sys/dev/pci/ubsec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ubsec.c,v 1.143 2009/03/27 13:31:30 reyk Exp $ */
+/* $OpenBSD: ubsec.c,v 1.144 2009/09/13 14:42:52 krw Exp $ */
/*
* Copyright (c) 2000 Jason L. Wright (jason@thought.net)
@@ -1159,8 +1159,13 @@ ubsec_process(struct cryptop *crp)
err = ENOMEM;
goto errout;
}
- if (len == MHLEN)
- M_DUP_PKTHDR(m, q->q_src_m);
+ if (len == MHLEN) {
+ err = m_dup_pkthdr(m, q->q_src_m);
+ if (err) {
+ m_freem(m);
+ goto errout;
+ }
+ }
if (totlen >= MINCLSIZE) {
MCLGET(m, M_DONTWAIT);
if (m->m_flags & M_EXT)