[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/12] block/nvme: nvme_process_completion() fix bound for cid
|
From: |
Peter Maydell |
|
Subject: |
[PULL 08/12] block/nvme: nvme_process_completion() fix bound for cid |
|
Date: |
Mon, 6 Nov 2023 15:32:34 +0000 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
NVMeQueuePair::reqs has length NVME_NUM_REQS, which less than
NVME_QUEUE_SIZE by 1.
Fixes: 1086e95da17050 ("block/nvme: switch to a NVMeRequest freelist")
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Maksim Davydov <davydov-max@yandex-team.ru>
Message-id: 20231017125941.810461-5-vsementsov@yandex-team.ru
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
block/nvme.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/block/nvme.c b/block/nvme.c
index 96b3f8f2fa1..0a0a0a6b36c 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -417,9 +417,10 @@ static bool nvme_process_completion(NVMeQueuePair *q)
q->cq_phase = !q->cq_phase;
}
cid = le16_to_cpu(c->cid);
- if (cid == 0 || cid > NVME_QUEUE_SIZE) {
- warn_report("NVMe: Unexpected CID in completion queue: %"PRIu32", "
- "queue size: %u", cid, NVME_QUEUE_SIZE);
+ if (cid == 0 || cid > NVME_NUM_REQS) {
+ warn_report("NVMe: Unexpected CID in completion queue: %" PRIu32
+ ", should be within: 1..%u inclusively", cid,
+ NVME_NUM_REQS);
continue;
}
trace_nvme_complete_command(s, q->index, cid);
--
2.34.1
- [PULL 00/12] target-arm queue, Peter Maydell, 2023/11/06
- [PULL 01/12] hw/arm/virt: fix PMU IRQ registration, Peter Maydell, 2023/11/06
- [PULL 03/12] hw/arm/virt: Report correct register sizes in ACPI DBG2/SPCR tables., Peter Maydell, 2023/11/06
- [PULL 11/12] hw/arm/vexpress-a9: Remove useless mapping of RAM at address 0, Peter Maydell, 2023/11/06
- [PULL 04/12] tests/qtest/bios-tables-test: Update virt SPCR and DBG2 golden references, Peter Maydell, 2023/11/06
- [PULL 07/12] mc146818rtc: rtc_set_time(): initialize tm to zeroes, Peter Maydell, 2023/11/06
- [PULL 05/12] hw/i386/intel_iommu: vtd_slpte_nonzero_rsvd(): assert no overflow, Peter Maydell, 2023/11/06
- [PULL 06/12] util/filemonitor-inotify: qemu_file_monitor_watch(): assert no overflow, Peter Maydell, 2023/11/06
- [PULL 10/12] io/channel-socket: qio_channel_socket_flush(): improve msg validation, Peter Maydell, 2023/11/06
- [PULL 09/12] hw/core/loader: gunzip(): initialize z_stream, Peter Maydell, 2023/11/06
- [PULL 08/12] block/nvme: nvme_process_completion() fix bound for cid,
Peter Maydell <=
- [PULL 02/12] tests/qtest/bios-tables-test: Allow changes to virt SPCR and DBG2, Peter Maydell, 2023/11/06
- [PULL 12/12] target/arm: Fix A64 LDRA immediate decode, Peter Maydell, 2023/11/06
- Re: [PULL 00/12] target-arm queue, Stefan Hajnoczi, 2023/11/06