[PATCH] mpi: Fix NULL ptr dereference in mpi_powm()

2016-11-23 Thread Andrey Ryabinin
Parsing certain certificates (see [1]) triggers NULL-ptr dereference in mpi_powm(): BUG: unable to handle kernel NULL pointer dereference at (null) IP: [] mpi_powm+0xf8/0x10b0 ... Call Trace: [] _rsa_dec.isra.2+0x66/0x80 [] rsa_verify+0x103/0x1c0

[PATCH] X.509: Fix double free in x509_cert_parse()

2016-11-23 Thread Andrey Ryabinin
We shouldn't free cert->pub->key in x509_cert_parse() because x509_free_certificate() also does this: BUG: Double free or freeing an invalid pointer ... Call Trace: [] dump_stack+0x63/0x83 [] kasan_object_err+0x21/0x70 []

[PATCH] crypto: acomp - don't use stack buffer in test_acomp()

2016-11-23 Thread Eric Biggers
With virtually-mapped stacks (CONFIG_VMAP_STACK=y), using the scatterlist crypto API with stack buffers is not allowed, and with appropriate debugging options will cause the 'BUG_ON(!virt_addr_valid(buf));' in sg_set_buf() to be triggered. Use a heap buffer instead. Fixes: d7db7a882deb ("crypto: