- Resolves: CVE-2024-45779 CVE-2024-45778 CVE-2025-1118 - Resolves: CVE-2025-0677 CVE-2024-45782 CVE-2025-0690 - Resolves: CVE-2024-45783 CVE-2025-0624 CVE-2024-45776 - Resolves: CVE-2025-0622 CVE-2024-45774 CVE-2024-45775 - Resolves: CVE-2024-45781 CVE-2024-45780 - Resolves: #RHEL-79700 - Resolves: #RHEL-79341 - Resolves: #RHEL-79875 - Resolves: #RHEL-79849 - Resolves: #RHEL-79707 - Resolves: #RHEL-79857 - Resolves: #RHEL-79709 - Resolves: #RHEL-79846 - Resolves: #RHEL-75737 - Resolves: #RHEL-79713 - Resolves: #RHEL-73785 - Resolves: #RHEL-73787 - Resolves: #RHEL-79704 - Resolves: #RHEL-79702 Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
47 lines
1.8 KiB
Diff
47 lines
1.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Michael Chang <mchang@suse.com>
|
|
Date: Fri, 31 May 2024 15:14:23 +0800
|
|
Subject: [PATCH] fs/ext2: Fix out-of-bounds read for inline extents
|
|
|
|
When inline extents are used, i.e. the extent tree depth equals zero,
|
|
a maximum of four entries can fit into the inode's data block. If the
|
|
extent header states a number of entries greater than four the current
|
|
ext2 implementation causes an out-of-bounds read. Fix this issue by
|
|
capping the number of extents to four when reading inline extents.
|
|
|
|
Reported-by: Daniel Axtens <dja@axtens.net>
|
|
Signed-off-by: Michael Chang <mchang@suse.com>
|
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
---
|
|
grub-core/fs/ext2.c | 10 +++++++++-
|
|
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c
|
|
index 731d346f8..eac639e36 100644
|
|
--- a/grub-core/fs/ext2.c
|
|
+++ b/grub-core/fs/ext2.c
|
|
@@ -481,6 +481,8 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
|
|
struct grub_ext4_extent *ext;
|
|
int i;
|
|
grub_disk_addr_t ret;
|
|
+ grub_uint16_t nent;
|
|
+ const grub_uint16_t max_inline_ext = sizeof (inode->blocks) / sizeof (*ext) - 1; /* Minus 1 extent header. */
|
|
|
|
leaf = grub_ext4_find_leaf (data, (struct grub_ext4_extent_header *) inode->blocks.dir_blocks, fileblock);
|
|
if (! leaf)
|
|
@@ -490,7 +492,13 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
|
|
}
|
|
|
|
ext = (struct grub_ext4_extent *) (leaf + 1);
|
|
- for (i = 0; i < grub_le_to_cpu16 (leaf->entries); i++)
|
|
+
|
|
+ nent = grub_le_to_cpu16 (leaf->entries);
|
|
+
|
|
+ if (leaf->depth == 0)
|
|
+ nent = grub_min (nent, max_inline_ext);
|
|
+
|
|
+ for (i = 0; i < nent; i++)
|
|
{
|
|
if (fileblock < grub_le_to_cpu32 (ext[i].block))
|
|
break;
|