crypto: hisilicon: Wipe entire pool on error
authorKees Cook <keescook@chromium.org>
Fri, 6 Jan 2023 04:19:48 +0000 (20:19 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:39:49 +0000 (09:39 +0100)
commitbcb03f2be982381d41eefa6e576c3e798b8edb53
treeb6cac420b30ddcfe9fc4af240167b902788e3ba2
parentf1e093291cd63cc2f722fdc92d0a1d5f95d27311
crypto: hisilicon: Wipe entire pool on error

[ Upstream commit aa85923a954e7704bc9d3847dabeb8540aa98d13 ]

To work around a Clang __builtin_object_size bug that shows up under
CONFIG_FORTIFY_SOURCE and UBSAN_BOUNDS, move the per-loop-iteration
mem_block wipe into a single wipe of the entire pool structure after
the loop.

Reported-by: Nathan Chancellor <nathan@kernel.org>
Link: https://github.com/ClangBuiltLinux/linux/issues/1780
Cc: Weili Qian <qianweili@huawei.com>
Cc: Zhou Wang <wangzhou1@hisilicon.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-crypto@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Tested-by: Nathan Chancellor <nathan@kernel.org> # build
Link: https://lore.kernel.org/r/20230106041945.never.831-kees@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/crypto/hisilicon/sgl.c