OpenCloudOS-Kernel/drivers/crypto/virtio
zhenwei pi b0365460e9 crypto: virtio/akcipher - Fix stack overflow on memcpy
commit c0ec2a712daf133d9996a8a1b7ee2d4996080363 upstream.

sizeof(struct virtio_crypto_akcipher_session_para) is less than
sizeof(struct virtio_crypto_op_ctrl_req::u), copying more bytes from
stack variable leads stack overflow. Clang reports this issue by
commands:
make -j CC=clang-14 mrproper >/dev/null 2>&1
make -j O=/tmp/crypto-build CC=clang-14 allmodconfig >/dev/null 2>&1
make -j O=/tmp/crypto-build W=1 CC=clang-14 drivers/crypto/virtio/
  virtio_crypto_akcipher_algs.o

Fixes: 59ca6c9338 ("virtio-crypto: implement RSA algorithm")
Link: https://lore.kernel.org/all/0a194a79-e3a3-45e7-be98-83abd3e1cb7e@roeck-us.net/
Cc: <stable@vger.kernel.org>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Tested-by: Nathan Chancellor <nathan@kernel.org> # build
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-01 13:35:01 +01:00
..
Kconfig virtio-crypto: implement RSA algorithm 2022-03-28 16:52:58 -04:00
Makefile virtio-crypto: rename skcipher algs 2022-03-28 16:52:58 -04:00
virtio_crypto_akcipher_algs.c crypto: virtio/akcipher - Fix stack overflow on memcpy 2024-03-01 13:35:01 +01:00
virtio_crypto_common.h crypto: virtio - Handle dataq logic with tasklet 2024-01-25 15:35:15 -08:00
virtio_crypto_core.c crypto: virtio - Wait for tasklet to complete on device remove 2024-01-25 15:35:17 -08:00
virtio_crypto_mgr.c virtio-crypto: rename skcipher algs 2022-03-28 16:52:58 -04:00
virtio_crypto_skcipher_algs.c crypto: virtio - Use new crypto_engine_op interface 2023-08-18 17:01:11 +08:00