- hw/virtio/virtio-crypto: Protect from DMA re-entrancy bugs(CVE-2024-3446) - hw/char/virtio-serial-bus: Protect from DMA re-entrancy bugs(CVE-2024-3446) - hw/display/virtio-gpu: Protect from DMA re-entrancy bugs(CVE-2024-3446) - hw/virtio: Introduce virtio_bh_new_guarded() helper - hw: replace most qemu_bh_new calls with qemu_bh_new_guarded - checkpatch: add qemu_bh_new/aio_bh_new checks - async: avoid use-after-free on re-entrancy guard - async: Add an optional reentrancy guard to the BH API - hw/sd/sdhci: Do not update TRNMOD when Command Inhibit (DAT) is set(CVE-2024-3447) - rtl8139: Remove unused variable - tulip: Remove unused variable - virtio-mem: Fix the bitmap index of the section offset - virtio-mem: Fix the iterator variable in a vmem->rdl_list loop - system/memory: use ldn_he_p/stn_he_p - block: Fix crash when loading snapshot on inactive node - smmu: Clear SMMUPciBus pointer cache when system reset - block/mirror: Fix NULL s->job in active writes - amd_iommu: Fix APIC address check - virtio-crypto: fix NULL pointer dereference in virtio_crypto_free_reques - libqos/virtio.c: Correct 'flags' reading in qvirtqueue_kick cherry-pick from 66e411885a23c96ff73742d06b793fec3ceaebb7 - ivshmem-test.c: enable test_ivshmem_server for ppc64 arch - ivshmem.c: change endianness to LITTLE_ENDIAN - hw/ppc/mac.h: Remove MAX_CPUS macro - configure: remove dead variables - virtio-gpu: do not byteswap padding - hw/intc: clean-up error reporting for failed ITS cmd - qemu-iotests: Discard stderr when probing devices - linux-user: un-parent OBJECT(cpu) when closing thread - hw/net/rocker: Avoid undefined shifts with more than 31 ports - contrib/vhost-user-blk: Clean up deallocation of VuVirtqElement - scsi-disk: fix overflow when block size is not a multiple of BDRV_SECTOR_SIZE Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com> (cherry picked from commit bf54b48c2963c869dfdc89977c57be4bd9e772aa)
57 lines
2.1 KiB
Diff
57 lines
2.1 KiB
Diff
From 7e0e009f5e5b39fc59aaa082cc092cb6438e5842 Mon Sep 17 00:00:00 2001
|
|
From: zhujun2 <zhujun2_yewu@cmss.chinamobile.com>
|
|
Date: Wed, 10 Apr 2024 23:03:47 -0700
|
|
Subject: [PATCH] virtio-crypto: fix NULL pointer dereference in
|
|
virtio_crypto_free_reques
|
|
|
|
Ensure op_info is not NULL in case of QCRYPTODEV_BACKEND_ALG_SYM algtype.
|
|
|
|
Fixes: 0e660a6f90a ("crypto: Introduce RSA algorithm")
|
|
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
|
|
Reported-by: Yiming Tao <taoym@zju.edu.cn>
|
|
Message-Id: <20230509075317.1132301-1-mcascell@redhat.com>
|
|
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
|
|
Reviewed-by: zhenwei pi<pizhenwei@bytedance.com>
|
|
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
(cherry picked from commit 3e69908907f8d3dd20d5753b0777a6e3824ba824)
|
|
Signed-off-by: zhujun2 <zhujun2_yewu@cmss.chinamobile.com>
|
|
---
|
|
hw/virtio/virtio-crypto.c | 20 +++++++++++---------
|
|
1 file changed, 11 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
|
|
index 61b421aab3..8c2047f4e0 100644
|
|
--- a/hw/virtio/virtio-crypto.c
|
|
+++ b/hw/virtio/virtio-crypto.c
|
|
@@ -349,15 +349,17 @@ static void virtio_crypto_free_request(VirtIOCryptoReq *req)
|
|
size_t max_len;
|
|
CryptoDevBackendSymOpInfo *op_info = req->u.sym_op_info;
|
|
|
|
- max_len = op_info->iv_len +
|
|
- op_info->aad_len +
|
|
- op_info->src_len +
|
|
- op_info->dst_len +
|
|
- op_info->digest_result_len;
|
|
-
|
|
- /* Zeroize and free request data structure */
|
|
- memset(op_info, 0, sizeof(*op_info) + max_len);
|
|
- g_free(op_info);
|
|
+ if (op_info) {
|
|
+ max_len = op_info->iv_len +
|
|
+ op_info->aad_len +
|
|
+ op_info->src_len +
|
|
+ op_info->dst_len +
|
|
+ op_info->digest_result_len;
|
|
+
|
|
+ /* Zeroize and free request data structure */
|
|
+ memset(op_info, 0, sizeof(*op_info) + max_len);
|
|
+ g_free(op_info);
|
|
+ }
|
|
}
|
|
g_free(req);
|
|
}
|
|
--
|
|
2.27.0
|
|
|