]> git.baikalelectronics.ru Git - kernel.git/commit
pstore: Set tfm to NULL on free_buf_for_compression
authorPi-Hsun Shih <pihsun@chromium.org>
Mon, 20 May 2019 06:51:19 +0000 (14:51 +0800)
committerKees Cook <keescook@chromium.org>
Fri, 31 May 2019 07:32:06 +0000 (00:32 -0700)
commitfc172953ec88149d767ee8a351aeaa1c039eeeba
treed272383bd25c4efd32c2d3449aeb76cabf52314b
parent49250288820449e26abffc1305ba221bd05ce90d
pstore: Set tfm to NULL on free_buf_for_compression

Set tfm to NULL on free_buf_for_compression() after crypto_free_comp().

This avoid a use-after-free when allocate_buf_for_compression()
and free_buf_for_compression() are called twice. Although
free_buf_for_compression() freed the tfm, allocate_buf_for_compression()
won't reinitialize the tfm since the tfm pointer is not NULL.

Fixes: a3dd775e5994 ("pstore: Refactor compression initialization")
Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org>
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
fs/pstore/platform.c