!21 Fix CVE-2023-1544

Merge pull request !21 from zeng_chi/openkylin/yangtze
This commit is contained in:
刘聪 2024-05-31 06:13:45 +00:00 committed by Gitee
commit 508d644304
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 22 additions and 2 deletions

8
debian/changelog vendored
View File

@ -1,4 +1,10 @@
qemu (1:7.1.0-ok13ubuntu1) yangtze; urgency=medium
qemu (1:7.1.0-ok15) yangtze; urgency=medium
* CVE-2023-1544
-- root <zengchi@kylinos.cn> Tue, 28 May 2024 13:47:35 +0800
qemu (1:7.1.0-ok14) yangtze; urgency=medium
* CVE-2023-3354

View File

@ -91,19 +91,33 @@ static int init_dev_ring(PvrdmaRing *ring, PvrdmaRingState **ring_state,
dma_addr_t dir_addr, uint32_t num_pages)
{
uint64_t *dir, *tbl;
int rc = 0;
int max_pages, rc = 0;
if (!num_pages) {
rdma_error_report("Ring pages count must be strictly positive");
return -EINVAL;
}
/*
* Make sure we can satisfy the requested number of pages in a single
* TARGET_PAGE_SIZE sized page table (taking into account that first entry
* is reserved for ring-state)
*/
max_pages = TARGET_PAGE_SIZE / sizeof(dma_addr_t) - 1;
if (num_pages > max_pages) {
rdma_error_report("Maximum pages on a single directory must not exceed %d\n",
max_pages);
return -EINVAL;
}
dir = rdma_pci_dma_map(pci_dev, dir_addr, TARGET_PAGE_SIZE);
if (!dir) {
rdma_error_report("Failed to map to page directory (ring %s)", name);
rc = -ENOMEM;
goto out;
}
/* We support only one page table for a ring */
tbl = rdma_pci_dma_map(pci_dev, dir[0], TARGET_PAGE_SIZE);
if (!tbl) {
rdma_error_report("Failed to map to page table (ring %s)", name);