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

[PATCH] Fix ASSERT failures in error paths


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Mon, 30 Jan 2023 14:42:19 +0000
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Owen Smith <owen.smith@xxxxxxxxxx>
  • Delivery-date: Mon, 30 Jan 2023 14:42:48 +0000
  • Ironport-data: A9a23:wSRwIqi7k7fuP9IaB1Xae3XiX161FxAKZh0ujC45NGQN5FlHY01je htvC22AM62KYTb0Kd8iOdu2oU5S7JDTx9VmG1BupS80FC4b9cadCdqndUqhZCn6wu8v7q5Ex 55HNoSfdpBcolv0/ErF3m3J9CEkvU2wbuOgTrWCYmUpH1QMpB4J0XpLg/Q+jpNjne+3CgaMv cKai8DEMRqu1iUc3lg8sspvkzsy+qWt0N8klgZmP6sT5QSGzyN94K83fsldEVOpGuG4IcbiL wrz5OnR1n/U+R4rFuSknt7TGqHdauePVeQmoiM+t5mK2nCulARrukoIHKN0hXNsoyeIh7hMJ OBl7vRcf+uL0prkw4zxWzEAe8130DYvFLXveRBTuuTLp6HKnueFL1yDwyjaMKVBktubD12i+ tQzF2EELVOkxNju55u7ELA2iPoSHOzCadZ3VnFIlVk1DN4jSJHHBa7L+cVZzHE7gcUm8fT2P pRDL2A1NVKZPkMJYw1MYH49tL7Aan3XdCJVrhSOoKsr40DYzRBr0airO93QEjCPbZQOwR/C+ TOYl4j/KhcgDv2O5iu1yymDltXewyPdd9sDKYTto5aGh3XMnzdOWXX6T2CTvvi/z1agHt5SN UEQ0i4vtrQpslymSMHnWB+1q2LCuQQTM+e8CMVjtlvLkPCNpV/EWC5dFGUphMEaWNEebgN73 xzKuJDTXRtGsOfME3yjx4exhGbnUcQKFlMqaSgBRAoDxtDspoAvkx7CJupe/L6JYs7dQm+pn W3TxMQqr/BK1JNQif3nlbzSq2j0zqUlWDLZ8ek+soiNygpiLLCoaIWzgbQwxaYRdd3JJrVtU ZVtpiR/0AzsJcvW/MBuaL9XdF1M2xpiGGC0vLKXN8N9nwlBAlb6FWyq3BlwJV1yLuEPciLzb UnYtGt5vcEMYSPzMvYnP9rgVKzGKJQM8vy8BpjpgidmOMAtJGdrAgkxDaJv44wduBd1yvxuU XtqWc2tEWwbGcxaIMmeHo8gPUsQ7nlmnwv7HMmrpylLJJLCPBZ5v59ZagrRBg34hYvYyDjoH yF3bJXWlEQPDL2nMkE6M+c7dDg3EJTyPriuw+Q/SwJJClMO9L0JYxMJ/Y4cRg==
  • Ironport-hdrordr: A9a23:4anEwKvzmoQrNQSZKCuMIF3A7skDstV00zEX/kB9WHVpm6yj+v xG/c5rsCMc7Qx6ZJhOo7+90cW7L080lqQFg7X5X43DYOCOggLBQL2KhbGI/9SKIVycygcy78 Zdm6gVMqyLMbB55/yKnTVRxbwbsaW6GKPDv5ag8590JzsaD52Jd21Ce36m+ksdfnggObMJUK Cyy+BgvDSadXEefq2AdwI4t7iqnaysqHr+CyR2fiIa1A==
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

* StorePrepareRequest can fail if a non-NULL transaction is passed.
  Check the return value where a transaction is passed to StorePrepareRequest
* StoreSubmitRequest should zero the request if it fails.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/xenbus/store.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/xenbus/store.c b/src/xenbus/store.c
index 5ffea1f..778414c 100644
--- a/src/xenbus/store.c
+++ b/src/xenbus/store.c
@@ -966,6 +966,8 @@ StoreSubmitRequest(
 fail1:
     Error("fail1 (%08x)\n", status);
 
+    RtlZeroMemory(Request, sizeof (XENBUS_STORE_REQUEST));
+
     return NULL;
 }
 
@@ -1571,17 +1573,18 @@ StoreTransactionEnd(
                                  XS_TRANSACTION_END,
                                  (Commit) ? "T" : "F", 2,
                                  NULL, 0);
-    ASSERT(NT_SUCCESS(status));
+    if (!NT_SUCCESS(status))
+        goto fail1;
 
     Response = StoreSubmitRequest(Context, &Request);
 
     status = STATUS_NO_MEMORY;
     if (Response == NULL)
-        goto fail1;
+        goto fail2;
 
     status = StoreCheckResponse(Response);
     if (!NT_SUCCESS(status) && status != STATUS_RETRY)
-        goto fail2;
+        goto fail3;
 
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
@@ -1605,11 +1608,13 @@ done:
 
     return status;
 
-fail2:
+fail3:
     ASSERT3U(status, !=, STATUS_RETRY);
 
     StoreFreeResponse(Response);
 
+fail2:
+
 fail1:
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
-- 
2.39.0.windows.1




 


Rackspace

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