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

[PATCH v2] Fix failure cleanup in EvtchnFifoAcquire



The current index is incremented before checking for failure:

    while (Index < ProcessorCount) {
        Index++;
        [...]
        if (!NT_SUCCESS(status))
            goto fail1;
        Context->ControlBlockMdl[vcpu_id] = Mdl;
    }

Make the main loop a normal for loop to avoid calling __FreePage on
invalid PMDLs.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
 src/xenbus/evtchn_fifo.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/xenbus/evtchn_fifo.c b/src/xenbus/evtchn_fifo.c
index 1137dea..fd06ef4 100644
--- a/src/xenbus/evtchn_fifo.c
+++ b/src/xenbus/evtchn_fifo.c
@@ -502,16 +502,13 @@ EvtchnFifoAcquire(
 
     ProcessorCount = KeQueryMaximumProcessorCountEx(ALL_PROCESSOR_GROUPS);
 
-    Index = 0;
-    while (Index < ProcessorCount) {
+    for (Index = 0; Index < ProcessorCount; Index++) {
         unsigned int        vcpu_id;
         PFN_NUMBER          Pfn;
         PHYSICAL_ADDRESS    Address;
 
         status = SystemProcessorVcpuId(Index, &vcpu_id);
 
-        Index++;
-
         if (status == STATUS_NOT_SUPPORTED)
             continue;
 
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




 


Rackspace

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