]> git.baikalelectronics.ru Git - kernel.git/commit
staging: ccree: fix leak of import() after init()
authorGilad Ben-Yossef <gilad@benyossef.com>
Thu, 9 Nov 2017 09:16:09 +0000 (09:16 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2017 13:36:45 +0000 (14:36 +0100)
commit116195dfd968ff962b1ce396a2494d20bc4296a1
tree1c7110deb64e6cb990154ecba93a217614269b05
parent791b78581752047eebcaf5a78078e82e6525cfde
staging: ccree: fix leak of import() after init()

crypto_ahash_import() may be called either after
crypto_ahash_init() or without such call. Right now
we always internally call init() as part of
import(), thus leaking memory and mappings if the
user has already called init() herself.

Fix this by only calling init() internally if the
state is not already initialized.

Fixes: commit fd184afbdff9 ("staging: ccree: fix hash import/export")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ccree/ssi_hash.c