linux/include/crypto
Herbert Xu 9a8ecc6a3e crypto: af_alg - fix use-after-free in af_alg_accept() due to bh_lock_sock()
commit 34c86f4c4a upstream.

The locking in af_alg_release_parent is broken as the BH socket
lock can only be taken if there is a code-path to handle the case
where the lock is owned by process-context.  Instead of adding
such handling, we can fix this by changing the ref counts to
atomic_t.

This patch also modifies the main refcnt to include both normal
and nokey sockets.  This way we don't have to fudge the nokey
ref count when a socket changes from nokey to normal.

Credits go to Mauricio Faria de Oliveira who diagnosed this bug
and sent a patch for it:

https://lore.kernel.org/linux-crypto/20200605161657.535043-1-mfo@canonical.com/

Reported-by: Brian Moyles <bmoyles@netflix.com>
Reported-by: Mauricio Faria de Oliveira <mfo@canonical.com>
Fixes: 37f96694cf ("crypto: af_alg - Use bh_lock_sock in...")
Cc: <stable@vger.kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-09 09:37:10 +02:00
..
internal crypto: simd - allow registering multiple algorithms at once 2018-03-03 00:03:17 +08:00
acompress.h
aead.h crypto: aead - prevent using AEADs without setting key 2018-01-12 23:03:39 +11:00
aes.h
akcipher.h
algapi.h crypto: api - laying defines and checks for statically allocated buffers 2018-04-21 00:58:32 +08:00
authenc.h
b128ops.h
blowfish.h
cast_common.h
cast5.h
cast6.h
cbc.h
chacha20.h crypto: chacha20 - Fix chacha20_block() keystream alignment (again) 2019-11-20 18:47:11 +01:00
cryptd.h
crypto_wq.h
ctr.h
des.h
dh.h crypto: dh - add public key verification test 2018-07-09 00:26:22 +08:00
drbg.h crypto: drbg - in-place cipher operation for CTR 2018-08-03 18:05:48 +08:00
ecdh.h
engine.h crypto: engine - Permit to enqueue all async requests 2018-02-15 23:26:50 +08:00
gcm.h
gf128mul.h
ghash.h
hash_info.h
hash.h crypto: hash - Prevent use of req->result in ahash update 2018-03-16 23:35:52 +08:00
hmac.h
if_alg.h crypto: af_alg - fix use-after-free in af_alg_accept() due to bh_lock_sock() 2020-07-09 09:37:10 +02:00
kpp.h
mcryptd.h crypto: mcryptd - protect the per-CPU queue with a lock 2017-12-11 22:29:54 +11:00
md5.h
morus_common.h crypto: morus - Add generic MORUS AEAD implementations 2018-05-19 00:15:00 +08:00
morus640_glue.h crypto: morus - Add common SIMD glue code for MORUS 2018-05-19 00:15:18 +08:00
morus1280_glue.h crypto: morus - Add common SIMD glue code for MORUS 2018-05-19 00:15:18 +08:00
null.h crypto: null - Get rid of crypto_{get,put}_default_null_skcipher2() 2017-12-22 19:29:08 +11:00
padlock.h
pcrypt.h
pkcs7.h
poly1305.h crypto: poly1305 - remove ->setkey() method 2018-01-12 23:03:14 +11:00
public_key.h
rng.h
scatterwalk.h crypto: scatterwalk - remove scatterwalk_samebuf() 2018-08-03 18:06:04 +08:00
serpent.h
sha.h crypto: sha512_generic - add a sha384 0-length pre-computed hash 2018-06-22 23:03:05 +08:00
sha1_base.h
sha3.h crypto: sha3-generic - export init/update/final routines 2018-01-26 01:10:34 +11:00
sha256_base.h
sha512_base.h
skcipher.h crypto: skcipher - prevent using skciphers without setting key 2018-01-12 23:03:39 +11:00
sm3_base.h
sm3.h
sm4.h crypto: sm4 - export encrypt/decrypt routines to other drivers 2018-05-05 14:52:51 +08:00
twofish.h
xts.h crypto: xts - remove xts_crypt() 2018-03-03 00:03:33 +08:00