[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging-4.12] x86/ioapic: Fix fixmap error path logic in ioapic_init_mappings()



commit e0bd8996b40066ffda685ea7c6f01aae6a86b984
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Sep 11 14:57:38 2020 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Sep 11 14:57:38 2020 +0200

    x86/ioapic: Fix fixmap error path logic in ioapic_init_mappings()
    
    In the case that bad_ioapic_register() fails, the current position of idx++
    means that clear_fixmap(idx) will be called with the wrong index, and not
    clean up the mapping just created.
    
    Increment idx as part of the loop, rather than midway through the loop body.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: b4175c6693e089ffcd77cd1ea388e76e67d36d57
    master date: 2020-08-05 17:35:11 +0100
---
 xen/arch/x86/io_apic.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 44865a35ac..b4c6b90456 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2525,7 +2525,7 @@ void __init init_ioapic_mappings(void)
 
     if ( smp_found_config )
         nr_irqs_gsi = 0;
-    for ( i = 0; i < nr_ioapics; i++ )
+    for ( i = 0; i < nr_ioapics; i++, idx++ )
     {
         if ( smp_found_config )
         {
@@ -2548,7 +2548,6 @@ void __init init_ioapic_mappings(void)
         set_fixmap_nocache(idx, ioapic_phys);
         apic_printk(APIC_VERBOSE, "mapped IOAPIC to %08Lx (%08lx)\n",
                     __fix_to_virt(idx), ioapic_phys);
-        idx++;
 
         if ( bad_ioapic_register(i) )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.