summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2012-01-13 09:53:25 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2012-01-13 09:53:25 +0000
commit5d33e89a6956aa9eba1522836d491556f72848b5 (patch)
tree5e050a3d5a3d4ed5e6844a3a0ad68c3bb4568817 /sys/dev/pci
parentffe459cb7def60bf29c44f2c53b5c82ca24713e2 (diff)
handle m_copyback errors, this code is too sensitive for such
failures to be neglected; ok markus
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/hifn7751.c16
-rw-r--r--sys/dev/pci/safe.c9
-rw-r--r--sys/dev/pci/ubsec.c8
3 files changed, 23 insertions, 10 deletions
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c
index c2143f0f5e5..1bfe3959c5f 100644
--- a/sys/dev/pci/hifn7751.c
+++ b/sys/dev/pci/hifn7751.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hifn7751.c,v 1.166 2011/04/05 11:48:28 blambert Exp $ */
+/* $OpenBSD: hifn7751.c,v 1.167 2012/01/13 09:53:24 mikeb Exp $ */
/*
* Invertex AEON / Hifn 7751 driver
@@ -2076,13 +2076,16 @@ hifn_process(struct cryptop *crp)
if ((enccrd->crd_flags & CRD_F_IV_PRESENT)
== 0) {
if (crp->crp_flags & CRYPTO_F_IMBUF)
- m_copyback(cmd->srcu.src_m,
+ err =
+ m_copyback(cmd->srcu.src_m,
enccrd->crd_inject,
ivlen, cmd->iv, M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copyback(cmd->srcu.src_io,
enccrd->crd_inject,
ivlen, cmd->iv);
+ if (err)
+ goto errout;
}
} else {
if (enccrd->crd_flags & CRD_F_IV_EXPLICIT)
@@ -2290,7 +2293,8 @@ hifn_callback(struct hifn_softc *sc, struct hifn_command *cmd,
if (cmd->sloplen != 0) {
if (crp->crp_flags & CRYPTO_F_IMBUF)
- m_copyback((struct mbuf *)crp->crp_buf,
+ crp->crp_etype =
+ m_copyback((struct mbuf *)crp->crp_buf,
cmd->src_map->dm_mapsize - cmd->sloplen,
cmd->sloplen, &dma->slop[cmd->slopidx],
M_NOWAIT);
@@ -2298,6 +2302,8 @@ hifn_callback(struct hifn_softc *sc, struct hifn_command *cmd,
cuio_copyback((struct uio *)crp->crp_buf,
cmd->src_map->dm_mapsize - cmd->sloplen,
cmd->sloplen, &dma->slop[cmd->slopidx]);
+ if (crp->crp_etype)
+ goto out;
}
i = dma->dstk; u = dma->dstu;
@@ -2343,7 +2349,8 @@ hifn_callback(struct hifn_softc *sc, struct hifn_command *cmd,
continue;
if (crp->crp_flags & CRYPTO_F_IMBUF)
- m_copyback((struct mbuf *)crp->crp_buf,
+ crp->crp_etype =
+ m_copyback((struct mbuf *)crp->crp_buf,
crd->crd_inject, len, macbuf, M_NOWAIT);
else if ((crp->crp_flags & CRYPTO_F_IOV) && crp->crp_mac)
bcopy((caddr_t)macbuf, crp->crp_mac, len);
@@ -2351,6 +2358,7 @@ hifn_callback(struct hifn_softc *sc, struct hifn_command *cmd,
}
}
+out:
if (cmd->src_map != cmd->dst_map) {
bus_dmamap_unload(sc->sc_dmat, cmd->dst_map);
bus_dmamap_destroy(sc->sc_dmat, cmd->dst_map);
diff --git a/sys/dev/pci/safe.c b/sys/dev/pci/safe.c
index 436caa04ac0..4b3441b2b17 100644
--- a/sys/dev/pci/safe.c
+++ b/sys/dev/pci/safe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: safe.c,v 1.33 2011/04/05 11:48:28 blambert Exp $ */
+/* $OpenBSD: safe.c,v 1.34 2012/01/13 09:53:24 mikeb Exp $ */
/*-
* Copyright (c) 2003 Sam Leffler, Errno Consulting
@@ -476,12 +476,14 @@ safe_process(struct cryptop *crp)
if ((enccrd->crd_flags & CRD_F_IV_PRESENT) == 0) {
if (crp->crp_flags & CRYPTO_F_IMBUF)
- m_copyback(re->re_src_m,
+ err = m_copyback(re->re_src_m,
enccrd->crd_inject, ivsize, iv,
M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copyback(re->re_src_io,
enccrd->crd_inject, ivsize, iv);
+ if (err)
+ goto errout;
}
for (i = 0; i < ivsize / sizeof(iv[0]); i++)
re->re_sastate.sa_saved_iv[i] = htole32(iv[i]);
@@ -1689,7 +1691,8 @@ safe_callback(struct safe_softc *sc, struct safe_ringentry *re)
bswap32(re->re_sastate.sa_saved_indigest[2]);
}
if (crp->crp_flags & CRYPTO_F_IMBUF) {
- m_copyback((struct mbuf *)crp->crp_buf,
+ crp->crp_etype =
+ m_copyback((struct mbuf *)crp->crp_buf,
crd->crd_inject, 12,
(caddr_t)re->re_sastate.sa_saved_indigest,
M_NOWAIT);
diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c
index 5fa1bd59a3f..2abd2abfd06 100644
--- a/sys/dev/pci/ubsec.c
+++ b/sys/dev/pci/ubsec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ubsec.c,v 1.153 2011/05/06 17:55:00 mikeb Exp $ */
+/* $OpenBSD: ubsec.c,v 1.154 2012/01/13 09:53:24 mikeb Exp $ */
/*
* Copyright (c) 2000 Jason L. Wright (jason@thought.net)
@@ -949,13 +949,15 @@ ubsec_process(struct cryptop *crp)
if ((enccrd->crd_flags & CRD_F_IV_PRESENT) == 0) {
if (crp->crp_flags & CRYPTO_F_IMBUF)
- m_copyback(q->q_src_m,
+ err = m_copyback(q->q_src_m,
enccrd->crd_inject,
ivlen, key.ses_iv, M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copyback(q->q_src_io,
enccrd->crd_inject,
ivlen, key.ses_iv);
+ if (err)
+ goto errout;
}
} else {
flags |= htole16(UBS_PKTCTX_INBOUND);
@@ -1443,7 +1445,7 @@ ubsec_callback(struct ubsec_softc *sc, struct ubsec_q *q)
crd->crd_alg != CRYPTO_SHA1_HMAC)
continue;
if (crp->crp_flags & CRYPTO_F_IMBUF)
- m_copyback((struct mbuf *)crp->crp_buf,
+ crp->crp_etype = m_copyback((struct mbuf *)crp->crp_buf,
crd->crd_inject, 12,
dmap->d_dma->d_macbuf, M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV && crp->crp_mac)