Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
hw/nvme: fix oob memory read in fdp events log
As reported by Trend Micro's Zero Day Initiative, an oob memory read
vulnerability exists in nvme_fdp_events(). The host-provided offset is
not verified.

Fix this.

This is only exploitable when Flexible Data Placement mode (fdp=on) is
enabled.

Fixes: CVE-2023-4135
Fixes: 73064ed ("hw/nvme: flexible data placement emulation")
Reported-by: Trend Micro's Zero Day Initiative
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
(cherry picked from commit ecb1b7b)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
birkelund authored and Michael Tokarev committed Sep 10, 2023
1 parent a11a200 commit dd496f9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hw/nvme/ctrl.c
Expand Up @@ -5092,6 +5092,11 @@ static uint16_t nvme_fdp_events(NvmeCtrl *n, uint32_t endgrpid,
}

log_size = sizeof(NvmeFdpEventsLog) + ebuf->nelems * sizeof(NvmeFdpEvent);

if (off >= log_size) {
return NVME_INVALID_FIELD | NVME_DNR;
}

trans_len = MIN(log_size - off, buf_len);
elog = g_malloc0(log_size);
elog->num_events = cpu_to_le32(ebuf->nelems);
Expand Down

0 comments on commit dd496f9

Please sign in to comment.