summaryrefslogtreecommitdiff
path: root/sys/arch/i386
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/arch/i386
parentffe459cb7def60bf29c44f2c53b5c82ca24713e2 (diff)
handle m_copyback errors, this code is too sensitive for such
failures to be neglected; ok markus
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/i386/via.c6
-rw-r--r--sys/arch/i386/pci/glxsb.c10
2 files changed, 11 insertions, 5 deletions
diff --git a/sys/arch/i386/i386/via.c b/sys/arch/i386/i386/via.c
index f3c8823f559..534257fbc7a 100644
--- a/sys/arch/i386/i386/via.c
+++ b/sys/arch/i386/i386/via.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: via.c,v 1.28 2011/04/20 06:51:35 deraadt Exp $ */
+/* $OpenBSD: via.c,v 1.29 2012/01/13 09:53:24 mikeb Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -377,7 +377,7 @@ viac3_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
if ((crd->crd_flags & CRD_F_IV_PRESENT) == 0) {
if (crp->crp_flags & CRYPTO_F_IMBUF)
- m_copyback((struct mbuf *)crp->crp_buf,
+ err = m_copyback((struct mbuf *)crp->crp_buf,
crd->crd_inject, 16, sc->op_iv, M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copyback((struct uio *)crp->crp_buf,
@@ -385,6 +385,8 @@ viac3_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
else
bcopy(sc->op_iv,
crp->crp_buf + crd->crd_inject, 16);
+ if (err)
+ return (err);
}
} else {
sc->op_cw[0] = ses->ses_cw0 | C3_CRYPT_CWLO_DECRYPT;
diff --git a/sys/arch/i386/pci/glxsb.c b/sys/arch/i386/pci/glxsb.c
index f0d7565c2ec..241053e8a71 100644
--- a/sys/arch/i386/pci/glxsb.c
+++ b/sys/arch/i386/pci/glxsb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: glxsb.c,v 1.23 2011/01/12 17:15:23 deraadt Exp $ */
+/* $OpenBSD: glxsb.c,v 1.24 2012/01/13 09:53:24 mikeb Exp $ */
/*
* Copyright (c) 2006 Tom Cosgrove <tom@openbsd.org>
@@ -673,7 +673,7 @@ glxsb_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
if ((crd->crd_flags & CRD_F_IV_PRESENT) == 0) {
if (crp->crp_flags & CRYPTO_F_IMBUF)
- m_copyback((struct mbuf *)crp->crp_buf,
+ err = m_copyback((struct mbuf *)crp->crp_buf,
crd->crd_inject, sizeof(op_iv), op_iv,
M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
@@ -682,6 +682,8 @@ glxsb_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
else
bcopy(op_iv,
crp->crp_buf + crd->crd_inject, sizeof(op_iv));
+ if (err)
+ goto out;
}
} else {
control = SB_CTL_DEC;
@@ -725,7 +727,7 @@ glxsb_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
glxsb_dma_post_op(sc, &sc->sc_dma);
if (crp->crp_flags & CRYPTO_F_IMBUF)
- m_copyback((struct mbuf *)crp->crp_buf,
+ err = m_copyback((struct mbuf *)crp->crp_buf,
crd->crd_skip + offset, len, op_dst, M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copyback((struct uio *)crp->crp_buf,
@@ -733,6 +735,8 @@ glxsb_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
else
bcopy(op_dst, crp->crp_buf + crd->crd_skip + offset,
len);
+ if (err)
+ break;
offset += len;
tlen -= len;