]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: algif_aead - fix uninitialized ctx->init
authorOndrej Mosnacek <omosnace@redhat.com>
Wed, 12 Aug 2020 12:58:25 +0000 (14:58 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 13 Aug 2020 07:09:32 +0000 (17:09 +1000)
commit79847d22abe9f1f5ec0a676bf1bc05a5dfbe07e4
tree64f287d2b506bc1f88147319dae4c32945b275f0
parent20a630c7f0c57755b288aedd1c432a7394382b85
crypto: algif_aead - fix uninitialized ctx->init

In skcipher_accept_parent_nokey() the whole af_alg_ctx structure is
cleared by memset() after allocation, so add such memset() also to
aead_accept_parent_nokey() so that the new "init" field is also
initialized to zero. Without that the initial ctx->init checks might
randomly return true and cause errors.

While there, also remove the redundant zero assignments in both
functions.

Found via libkcapi testsuite.

Cc: Stephan Mueller <smueller@chronox.de>
Fixes: b7dad8488f83 ("crypto: algif_aead - Only wake up when ctx->more is zero")
Suggested-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/algif_aead.c
crypto/algif_skcipher.c