diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2001-01-31 05:14:03 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2001-01-31 05:14:03 +0000 |
commit | c5b3499a1a42a41946d6742fd6899201891411f2 (patch) | |
tree | 946445711ff6f1c53571f7ad4b9e0c7a06aee5bf /sys | |
parent | 701b07ee22d8d939bd16ee2762ebbbd794a8dd69 (diff) |
before copying the packet header, make sure we actually got the mbuf
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/hifn7751.c | 9 | ||||
-rw-r--r-- | sys/dev/pci/ubsec.c | 9 |
2 files changed, 10 insertions, 8 deletions
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c index b61bede8adf..a63af5a148e 100644 --- a/sys/dev/pci/hifn7751.c +++ b/sys/dev/pci/hifn7751.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hifn7751.c,v 1.53 2000/11/22 17:51:14 mickey Exp $ */ +/* $OpenBSD: hifn7751.c,v 1.54 2001/01/31 05:14:02 jason Exp $ */ /* * Invertex AEON / Hi/fn 7751 driver @@ -867,15 +867,16 @@ hifn_crypto(sc, cmd) totlen = cmd->dst_l = cmd->src_l; if (cmd->src_m->m_flags & M_PKTHDR) { - MGETHDR(m, M_DONTWAIT, MT_DATA); - M_COPY_PKTHDR(m, cmd->src_m); len = MHLEN; + MGETHDR(m, M_DONTWAIT, MT_DATA); } else { - MGET(m, M_DONTWAIT, MT_DATA); len = MLEN; + MGET(m, M_DONTWAIT, MT_DATA); } if (m == NULL) return (-1); + if (len == MHLEN) + M_COPY_PKTHDR(m, cmd->src_m); if (totlen >= MINCLSIZE) { MCLGET(m, M_DONTWAIT); if (m->m_flags & M_EXT) diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c index 2d29a7f0e94..b82dc6c6b23 100644 --- a/sys/dev/pci/ubsec.c +++ b/sys/dev/pci/ubsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsec.c,v 1.38 2001/01/29 04:01:44 jason Exp $ */ +/* $OpenBSD: ubsec.c,v 1.39 2001/01/31 05:14:02 jason Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -829,17 +829,18 @@ ubsec_process(crp) totlen = q->q_dst_l = q->q_src_l; if (q->q_src_m->m_flags & M_PKTHDR) { - MGETHDR(m, M_DONTWAIT, MT_DATA); - M_COPY_PKTHDR(m, q->q_src_m); len = MHLEN; + MGETHDR(m, M_DONTWAIT, MT_DATA); } else { - MGET(m, M_DONTWAIT, MT_DATA); len = MLEN; + MGET(m, M_DONTWAIT, MT_DATA); } if (m == NULL) { err = ENOMEM; goto errout; } + if (len == MHLEN) + M_COPY_PKTHDR(m, q->q_src_m); if (totlen >= MINCLSIZE) { MCLGET(m, M_DONTWAIT); if (m->m_flags & M_EXT) |