]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: do not free algorithm before using
authorPan Bian <bianpan2016@163.com>
Thu, 22 Nov 2018 10:00:16 +0000 (18:00 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 29 Nov 2018 06:53:59 +0000 (14:53 +0800)
commitfb594a84e48a084f47eb0777a000d19124883cf6
treeff071a695559c7343c9ca04744794332368e0ecd
parent86aed2e3d70e10d324541e7d8ad99d62304ed070
crypto: do not free algorithm before using

In multiple functions, the algorithm fields are read after its reference
is dropped through crypto_mod_put. In this case, the algorithm memory
may be freed, resulting in use-after-free bugs. This patch delays the
put operation until the algorithm is never used.

Fixes: 6998e202d9b6 ("crypto: cbc - Convert to skcipher")
Fixes: 941563f8e2a4 ("crypto: cfb - add support for Cipher FeedBack mode")
Fixes: daa74392dcd9 ("crypto: pcbc - Convert to skcipher")
Cc: <stable@vger.kernel.org>
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/cbc.c
crypto/cfb.c
crypto/pcbc.c