linux/crypto
Rabin Vincent 7e77bdebff crypto: af_alg - fix backlog handling
If a request is backlogged, it's complete() handler will get called
twice: once with -EINPROGRESS, and once with the final error code.

af_alg's complete handler, unlike other users, does not handle the
-EINPROGRESS but instead always completes the completion that recvmsg()
is waiting on.  This can lead to a return to user space while the
request is still pending in the driver.  If userspace closes the sockets
before the requests are handled by the driver, this will lead to
use-after-frees (and potential crashes) in the kernel due to the tfm
having been freed.

The crashes can be easily reproduced (for example) by reducing the max
queue length in cryptod.c and running the following (from
http://www.chronox.de/libkcapi.html) on AES-NI capable hardware:

 $ while true; do kcapi -x 1 -e -c '__ecb-aes-aesni' \
    -k 00000000000000000000000000000000 \
    -p 00000000000000000000000000000000 >/dev/null & done

Cc: stable@vger.kernel.org
Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2014-12-22 22:53:55 +11:00
..
asymmetric_keys Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2014-10-12 10:13:55 -04:00
async_tx
842.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
ablk_helper.c
ablkcipher.c
aead.c
aes_generic.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
af_alg.c crypto: af_alg - fix backlog handling 2014-12-22 22:53:55 +11:00
ahash.c
algapi.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
algboss.c
algif_hash.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2014-12-13 13:33:26 -08:00
algif_skcipher.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2014-12-13 13:33:26 -08:00
ansi_cprng.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
anubis.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
api.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
arc4.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
authenc.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
authencesn.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
blkcipher.c
blowfish_common.c
blowfish_generic.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
camellia_generic.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
cast5_generic.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
cast6_generic.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
cast_common.c
cbc.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
ccm.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
chainiv.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
cipher.c
cmac.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
compress.c
crc32.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
crc32c_generic.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
crct10dif_common.c
crct10dif_generic.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
cryptd.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
crypto_null.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
crypto_user.c crypto: user - add MODULE_ALIAS 2014-11-26 20:06:29 +08:00
crypto_wq.c
ctr.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
cts.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
deflate.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
des_generic.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
drbg.c crypto: drbg - use memzero_explicit() for clearing sensitive data 2014-11-27 22:26:18 +08:00
ecb.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
eseqiv.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
fcrypt.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
fips.c
gcm.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
gf128mul.c
ghash-generic.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
hash_info.c
hmac.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
internal.h
Kconfig
khazad.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
krng.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
lrw.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
lz4.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
lz4hc.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
lzo.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
Makefile
mcryptd.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
md4.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
md5.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
memneq.c
michael_mic.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
pcbc.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
pcompress.c
pcrypt.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
proc.c
ripemd.h
rmd128.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
rmd160.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
rmd256.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
rmd320.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
rng.c
salsa20_generic.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
scatterwalk.c
seed.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
seqiv.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
serpent_generic.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
sha1_generic.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
sha256_generic.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
sha512_generic.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
shash.c
tcrypt.c crypto: tcrypt - Allow speed testing of arbitrary hash functions 2014-12-05 23:57:47 +08:00
tcrypt.h
tea.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
testmgr.c crypto: testmgr - Remove unnecessary KERN_INFO from testmgr.c 2014-10-24 22:49:36 +08:00
testmgr.h
tgr192.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
twofish_common.c
twofish_generic.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
vmac.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
wp512.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
xcbc.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
xor.c
xts.c crypto: include crypto- module prefix in template 2014-11-26 20:06:30 +08:00
zlib.c crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00