- 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)
56 lines
1.9 KiB
Diff
56 lines
1.9 KiB
Diff
From 4b01fe41d731409b8bf2b569a38aa5959ed473c4 Mon Sep 17 00:00:00 2001
|
|
From: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
|
|
Date: Mon, 25 Mar 2024 08:58:38 +0000
|
|
Subject: [PATCH] hw/net/rocker: Avoid undefined shifts with more than 31 ports
|
|
mainline inclusion
|
|
commit 7cf745dd9c25f0740dc1009598b58dd8dd989876
|
|
category: bugfix
|
|
|
|
---------------------------------------------------------------
|
|
|
|
In rocker_port_phys_link_status() and rocker_port_phys_enable_read()
|
|
we construct a 64-bit value with one bit per front-panel port.
|
|
However we accidentally do the shift as 32-bit arithmetic, which
|
|
means that if there are more than 31 front-panel ports this is
|
|
undefined behaviour.
|
|
|
|
Fix the problem by ensuring we use 64-bit arithmetic for the whole
|
|
calculation. (We won't ever shift off the 64-bit value because
|
|
ROCKER_FP_PORTS_MAX is 62.)
|
|
|
|
Resolves: Coverity CID 1487121, 1487160
|
|
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
|
|
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
Signed-off-by: Jason Wang <jasowang@redhat.com>
|
|
|
|
Signed-off-by: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
|
|
---
|
|
hw/net/rocker/rocker.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c
|
|
index 31f2340fb9..d8f3f16fe8 100644
|
|
--- a/hw/net/rocker/rocker.c
|
|
+++ b/hw/net/rocker/rocker.c
|
|
@@ -1010,7 +1010,7 @@ static uint64_t rocker_port_phys_link_status(Rocker *r)
|
|
FpPort *port = r->fp_port[i];
|
|
|
|
if (fp_port_get_link_up(port)) {
|
|
- status |= 1 << (i + 1);
|
|
+ status |= 1ULL << (i + 1);
|
|
}
|
|
}
|
|
return status;
|
|
@@ -1025,7 +1025,7 @@ static uint64_t rocker_port_phys_enable_read(Rocker *r)
|
|
FpPort *port = r->fp_port[i];
|
|
|
|
if (fp_port_enabled(port)) {
|
|
- ret |= 1 << (i + 1);
|
|
+ ret |= 1ULL << (i + 1);
|
|
}
|
|
}
|
|
return ret;
|
|
--
|
|
2.27.0
|
|
|