Fix a couple of bugs for asym crypto introduced in r359374.
- Check for null pointers in the crypto_drivers[] array when checking for empty slots in crypto_select_kdriver(). - Handle the case where crypto_kdone() is invoked on a request where krq_cap is NULL due to not finding a matching driver. Reviewed by: markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D26811
This commit is contained in:
parent
4fa4bd6312
commit
e7f6b6cf69
@ -1540,7 +1540,7 @@ again:
|
||||
* match), then skip.
|
||||
*/
|
||||
cap = crypto_drivers[hid];
|
||||
if (cap->cc_dev == NULL ||
|
||||
if (cap == NULL ||
|
||||
(cap->cc_flags & match) == 0)
|
||||
continue;
|
||||
|
||||
@ -1880,15 +1880,18 @@ crypto_kdone(struct cryptkop *krp)
|
||||
|
||||
if (krp->krp_status != 0)
|
||||
CRYPTOSTAT_INC(cs_kerrs);
|
||||
CRYPTO_DRIVER_LOCK();
|
||||
cap = krp->krp_cap;
|
||||
KASSERT(cap->cc_koperations > 0, ("cc_koperations == 0"));
|
||||
cap->cc_koperations--;
|
||||
if (cap->cc_koperations == 0 && cap->cc_flags & CRYPTOCAP_F_CLEANUP)
|
||||
wakeup(cap);
|
||||
CRYPTO_DRIVER_UNLOCK();
|
||||
krp->krp_cap = NULL;
|
||||
cap_rele(cap);
|
||||
if (cap != NULL) {
|
||||
CRYPTO_DRIVER_LOCK();
|
||||
KASSERT(cap->cc_koperations > 0, ("cc_koperations == 0"));
|
||||
cap->cc_koperations--;
|
||||
if (cap->cc_koperations == 0 &&
|
||||
cap->cc_flags & CRYPTOCAP_F_CLEANUP)
|
||||
wakeup(cap);
|
||||
CRYPTO_DRIVER_UNLOCK();
|
||||
krp->krp_cap = NULL;
|
||||
cap_rele(cap);
|
||||
}
|
||||
|
||||
ret_worker = CRYPTO_RETW(0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user