diff options
author | jhb <jhb@FreeBSD.org> | 2017-05-12 18:01:05 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2017-05-12 18:01:05 +0000 |
commit | a86ac57007320d2b6c2b78b0e2cbbe1e22fab034 (patch) | |
tree | 6df85565e0f8480439bdf2b7fc3979dd54544357 /sys/opencrypto | |
parent | 4d2f018c82bbae44270cd376e30c08b4f6c02b77 (diff) | |
download | FreeBSD-src-a86ac57007320d2b6c2b78b0e2cbbe1e22fab034.zip FreeBSD-src-a86ac57007320d2b6c2b78b0e2cbbe1e22fab034.tar.gz |
MFC 316510: Don't leak a session and lock if a GMAC key has an invalid length.
Diffstat (limited to 'sys/opencrypto')
-rw-r--r-- | sys/opencrypto/cryptosoft.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 052916b..e26390a 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -930,8 +930,11 @@ swcr_newsession(device_t dev, u_int32_t *sid, struct cryptoini *cri) axf = &auth_hash_nist_gmac_aes_256; auth4common: len = cri->cri_klen / 8; - if (len != 16 && len != 24 && len != 32) + if (len != 16 && len != 24 && len != 32) { + swcr_freesession_locked(dev, i); + rw_runlock(&swcr_sessions_lock); return EINVAL; + } (*swd)->sw_ictx = malloc(axf->ctxsize, M_CRYPTO_DATA, M_NOWAIT); |