diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2021-10-13 13:08:59 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2021-10-13 13:08:59 +0000 |
commit | d1e024176c87a67967f6f420011d4067fe2a0944 (patch) | |
tree | 12fff95b1415486a2c56a399c96ba260a8f96e18 /sys/dev/pci | |
parent | c91ef0f523c6bacfcf722eb21933240ac641b84d (diff) |
The kernel crypto framework sometimes returned an error, sometimes
the callback was called, and sometimes both. So the caller of that
API could not release resources correctly.
A bunch of errors can or should not happen, replace them with an
assert. Remove redundant checks. crypto_invoke() should not return
the error, but pass it via callback.
Some old hardware drivers keep part of their inconsistency as I
cannot test them.
OK mpi@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/hifn7751.c | 7 | ||||
-rw-r--r-- | sys/dev/pci/safe.c | 8 | ||||
-rw-r--r-- | sys/dev/pci/ubsec.c | 6 |
3 files changed, 4 insertions, 17 deletions
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c index 9e0ef43142d..cae21a06000 100644 --- a/sys/dev/pci/hifn7751.c +++ b/sys/dev/pci/hifn7751.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hifn7751.c,v 1.180 2020/05/29 04:42:25 deraadt Exp $ */ +/* $OpenBSD: hifn7751.c,v 1.181 2021/10/13 13:08:58 bluhm Exp $ */ /* * Invertex AEON / Hifn 7751 driver @@ -1925,11 +1925,6 @@ hifn_process(struct cryptop *crp) struct hifn_softc *sc; struct cryptodesc *crd1, *crd2 = NULL, *maccrd, *enccrd; - if (crp == NULL || crp->crp_callback == NULL) { - hifnstats.hst_invalid++; - return (EINVAL); - } - if (crp->crp_ilen == 0) { err = EINVAL; goto errout; diff --git a/sys/dev/pci/safe.c b/sys/dev/pci/safe.c index 639d44f6455..d95b0b3c8b6 100644 --- a/sys/dev/pci/safe.c +++ b/sys/dev/pci/safe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: safe.c,v 1.45 2021/02/25 02:48:20 dlg Exp $ */ +/* $OpenBSD: safe.c,v 1.46 2021/10/13 13:08:58 bluhm Exp $ */ /*- * Copyright (c) 2003 Sam Leffler, Errno Consulting @@ -310,11 +310,7 @@ safe_process(struct cryptop *crp) u_int32_t cmd0, cmd1, staterec, iv[4]; s = splnet(); - if (crp == NULL || crp->crp_callback == NULL) { - safestats.st_invalid++; - splx(s); - return (EINVAL); - } + card = SAFE_CARD(crp->crp_sid); if (card >= safe_cd.cd_ndevs || safe_cd.cd_devs[card] == NULL) { safestats.st_invalid++; diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c index aedc05eec2e..e52cd5911e9 100644 --- a/sys/dev/pci/ubsec.c +++ b/sys/dev/pci/ubsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsec.c,v 1.167 2021/02/25 02:48:20 dlg Exp $ */ +/* $OpenBSD: ubsec.c,v 1.168 2021/10/13 13:08:58 bluhm Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -781,10 +781,6 @@ ubsec_process(struct cryptop *crp) u_int16_t flags = 0; int ivlen = 0, keylen = 0; - if (crp == NULL || crp->crp_callback == NULL) { - ubsecstats.hst_invalid++; - return (EINVAL); - } card = UBSEC_CARD(crp->crp_sid); if (card >= ubsec_cd.cd_ndevs || ubsec_cd.cd_devs[card] == NULL) { ubsecstats.hst_invalid++; |