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

[PATCH] x86/ioapic: Fix fixmap error path logic in ioapic_init_mappings()


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Wed, 5 Aug 2020 13:51:09 +0100
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 05 Aug 2020 12:51:31 +0000
  • Ironport-sdr: H0IOtf+NmNNXtIb3vBP89mAfdirC7zbuDhNi6MaeCYBH7gNqSllvQWlWPDnHQfXv7QOxEAJPyE vqJDxUprDscE65Vj6snxU0t57kqjk2oJ1M0yuy3KDnHD04TyvydfNmf1H+SphV9xHPKAyrZism 9PK/9kl6k897Kz/WK2/qAX0s3Cn1EsLumCMdengXLaGHlK5qPkJ3eXtovNruFsqiVXpgGLp/ms tlOw/8QKUtNutCdWlFlwPP8RT14wVjnAfoVfRLfqRoyTYVq2ags30+95hytNMAEYu+0/bTSKcB VhA=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 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 878ee5192d..e66fa99ec7 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2543,7 +2543,7 @@ static void __init ioapic_init_mappings(void)
 
     nr_irqs_gsi = 0;
 
-    for ( i = 0; i < nr_ioapics; i++ )
+    for ( i = 0; i < nr_ioapics; i++, idx++ )
     {
         union IO_APIC_reg_01 reg_01;
         paddr_t ioapic_phys = mp_ioapics[i].mpc_apicaddr;
@@ -2560,7 +2560,6 @@ static void __init ioapic_init_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) )
         {
-- 
2.11.0




 


Rackspace

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