diff options
author | Bret Lambert <blambert@cvs.openbsd.org> | 2010-07-02 02:40:18 +0000 |
---|---|---|
committer | Bret Lambert <blambert@cvs.openbsd.org> | 2010-07-02 02:40:18 +0000 |
commit | bfc9493d9280a5a8ab43b8df30cd772c910140ba (patch) | |
tree | 32334a91bf10c89a8551f90fe6749d45476d9ad8 /sys/dev/pci | |
parent | 364840df3893a5f720df05ee307b996c62195a07 (diff) |
m_copyback can fail to allocate memory, but is a void fucntion so gymnastics
are required to detect that.
Change the function to take a wait argument (used in nfs server, but
M_NOWAIT everywhere else for now) and to return an error
ok claudio@ henning@ krw@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/hifn7751.c | 9 | ||||
-rw-r--r-- | sys/dev/pci/noct.c | 8 | ||||
-rw-r--r-- | sys/dev/pci/safe.c | 8 | ||||
-rw-r--r-- | sys/dev/pci/ubsec.c | 6 |
4 files changed, 17 insertions, 14 deletions
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c index e7234e4d68b..241c6edcf4e 100644 --- a/sys/dev/pci/hifn7751.c +++ b/sys/dev/pci/hifn7751.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hifn7751.c,v 1.160 2010/05/19 15:27:35 oga Exp $ */ +/* $OpenBSD: hifn7751.c,v 1.161 2010/07/02 02:40:16 blambert Exp $ */ /* * Invertex AEON / Hifn 7751 driver @@ -2082,7 +2082,7 @@ hifn_process(struct cryptop *crp) if (crp->crp_flags & CRYPTO_F_IMBUF) m_copyback(cmd->srcu.src_m, enccrd->crd_inject, - ivlen, cmd->iv); + ivlen, cmd->iv, M_NOWAIT); else if (crp->crp_flags & CRYPTO_F_IOV) cuio_copyback(cmd->srcu.src_io, enccrd->crd_inject, @@ -2293,7 +2293,8 @@ hifn_callback(struct hifn_softc *sc, struct hifn_command *cmd, if (crp->crp_flags & CRYPTO_F_IMBUF) m_copyback((struct mbuf *)crp->crp_buf, cmd->src_map->dm_mapsize - cmd->sloplen, - cmd->sloplen, &dma->slop[cmd->slopidx]); + cmd->sloplen, &dma->slop[cmd->slopidx], + M_NOWAIT); else if (crp->crp_flags & CRYPTO_F_IOV) cuio_copyback((struct uio *)crp->crp_buf, cmd->src_map->dm_mapsize - cmd->sloplen, @@ -2366,7 +2367,7 @@ hifn_callback(struct hifn_softc *sc, struct hifn_command *cmd, if (crp->crp_flags & CRYPTO_F_IMBUF) m_copyback((struct mbuf *)crp->crp_buf, - crd->crd_inject, len, macbuf); + 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); break; diff --git a/sys/dev/pci/noct.c b/sys/dev/pci/noct.c index e2fab9763c5..5556424a55b 100644 --- a/sys/dev/pci/noct.c +++ b/sys/dev/pci/noct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: noct.c,v 1.20 2008/06/09 07:07:16 djm Exp $ */ +/* $OpenBSD: noct.c,v 1.21 2010/07/02 02:40:16 blambert Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -911,7 +911,7 @@ noct_ea_thread(vsc) if (crp->crp_flags & CRYPTO_F_IMBUF) m_copyback((struct mbuf *)crp->crp_buf, crd->crd_inject, len, - q->q_macbuf); + q->q_macbuf, M_NOWAIT); else if (crp->crp_flags & CRYPTO_F_IOV) bcopy(q->q_macbuf, crp->crp_mac, len); } @@ -921,7 +921,7 @@ noct_ea_thread(vsc) if (crp->crp_flags & CRYPTO_F_IMBUF) m_copyback((struct mbuf *)crp->crp_buf, crd->crd_skip, crd->crd_len, - q->q_buf); + q->q_buf, M_NOWAIT); else if (crp->crp_flags & CRYPTO_F_IOV) cuio_copyback((struct uio *)crp->crp_buf, crd->crd_skip, crd->crd_len, @@ -1144,7 +1144,7 @@ noct_ea_start_des(sc, q, crp, crd) if (!(crd->crd_flags & CRD_F_IV_PRESENT)) { if (crp->crp_flags & CRYPTO_F_IMBUF) m_copyback((struct mbuf *)crp->crp_buf, - crd->crd_inject, 8, iv); + crd->crd_inject, 8, iv, M_NOWAIT); else if (crp->crp_flags & CRYPTO_F_IOV) cuio_copyback((struct uio *)crp->crp_buf, crd->crd_inject, 8, iv); diff --git a/sys/dev/pci/safe.c b/sys/dev/pci/safe.c index 189d24ccd1b..98111ccf67a 100644 --- a/sys/dev/pci/safe.c +++ b/sys/dev/pci/safe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: safe.c,v 1.28 2010/04/06 22:28:07 tedu Exp $ */ +/* $OpenBSD: safe.c,v 1.29 2010/07/02 02:40:16 blambert Exp $ */ /*- * Copyright (c) 2003 Sam Leffler, Errno Consulting @@ -476,7 +476,8 @@ 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, - enccrd->crd_inject, ivsize, iv); + 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); @@ -1719,7 +1720,8 @@ safe_callback(struct safe_softc *sc, struct safe_ringentry *re) if (crp->crp_flags & CRYPTO_F_IMBUF) { m_copyback((struct mbuf *)crp->crp_buf, crd->crd_inject, 12, - (caddr_t)re->re_sastate.sa_saved_indigest); + (caddr_t)re->re_sastate.sa_saved_indigest, + M_NOWAIT); } else if (crp->crp_flags & CRYPTO_F_IOV && crp->crp_mac) { bcopy((caddr_t)re->re_sastate.sa_saved_indigest, crp->crp_mac, 12); diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c index 5e0beb0dcf6..9a75dc320d4 100644 --- a/sys/dev/pci/ubsec.c +++ b/sys/dev/pci/ubsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsec.c,v 1.146 2010/04/08 00:23:53 tedu Exp $ */ +/* $OpenBSD: ubsec.c,v 1.147 2010/07/02 02:40:16 blambert Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -957,7 +957,7 @@ ubsec_process(struct cryptop *crp) if (crp->crp_flags & CRYPTO_F_IMBUF) m_copyback(q->q_src_m, enccrd->crd_inject, - ivlen, key.ses_iv); + ivlen, key.ses_iv, M_NOWAIT); else if (crp->crp_flags & CRYPTO_F_IOV) cuio_copyback(q->q_src_io, enccrd->crd_inject, @@ -1463,7 +1463,7 @@ ubsec_callback(struct ubsec_softc *sc, struct ubsec_q *q) if (crp->crp_flags & CRYPTO_F_IMBUF) m_copyback((struct mbuf *)crp->crp_buf, crd->crd_inject, 12, - dmap->d_dma->d_macbuf); + dmap->d_dma->d_macbuf, M_NOWAIT); else if (crp->crp_flags & CRYPTO_F_IOV && crp->crp_mac) bcopy((caddr_t)dmap->d_dma->d_macbuf, crp->crp_mac, 12); |