Skip to content

Commit 7039050

Browse files
committed
Merge tag 'x86-urgent-2026-05-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar: - Fix memory map enumeration bug in the Xen e820 parsing code (Juergen Gross) - Re-enable e820 BIOS fallback if e820 table is empty (David Gow) * tag 'x86-urgent-2026-05-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/boot/e820: Re-enable BIOS fallback if e820 table is empty x86/xen: Fix a potential problem in xen_e820_resolve_conflicts()
2 parents 6e1e5a3 + 5772f65 commit 7039050

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

arch/x86/kernel/e820.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,10 @@ __init static int append_e820_table(struct boot_e820_entry *entries, u32 nr_entr
450450
{
451451
struct boot_e820_entry *entry = entries;
452452

453+
/* If there aren't any entries, we'll want to fall back to another source: */
454+
if (!nr_entries)
455+
return -ENOENT;
456+
453457
while (nr_entries) {
454458
u64 start = entry->addr;
455459
u64 size = entry->size;
@@ -458,7 +462,7 @@ __init static int append_e820_table(struct boot_e820_entry *entries, u32 nr_entr
458462

459463
/* Ignore the remaining entries on 64-bit overflow: */
460464
if (start > end && likely(size))
461-
return -1;
465+
return -EINVAL;
462466

463467
e820__range_add(start, size, type);
464468

arch/x86/xen/setup.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -695,17 +695,22 @@ static void __init xen_e820_resolve_conflicts(phys_addr_t start,
695695
return;
696696

697697
end = start + size;
698-
entry = xen_e820_table.entries;
698+
mapcnt = 0;
699699

700-
for (mapcnt = 0; mapcnt < xen_e820_table.nr_entries; mapcnt++) {
700+
while (mapcnt < xen_e820_table.nr_entries) {
701+
entry = xen_e820_table.entries + mapcnt;
701702
if (entry->addr >= end)
702703
return;
703704

704705
if (entry->addr + entry->size > start &&
705-
entry->type == E820_TYPE_NVS)
706+
entry->type == E820_TYPE_NVS) {
706707
xen_e820_swap_entry_with_ram(entry);
708+
/* E820 map has been changed, restart loop! */
709+
mapcnt = 0;
710+
continue;
711+
}
707712

708-
entry++;
713+
mapcnt++;
709714
}
710715
}
711716

0 commit comments

Comments
 (0)