[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 4/4] Always check StorePrepareRequest's return value
StoreWatchAdd, StoreWatchRemove, StoreTransactionStart and StoreTransactionEnd functions should check the return value from StorePrepareRequest and goto the appropriate failure. Signed-off-by: david ambu <david.preetham@xxxxxxxxx> --- src/xenbus/store.c | 63 ++++++++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/src/xenbus/store.c b/src/xenbus/store.c index 39fd106..503144a 100644 --- a/src/xenbus/store.c +++ b/src/xenbus/store.c @@ -1595,18 +1595,18 @@ StoreTransactionStart( NULL, 0); KeReleaseSpinLock(&Context->Lock, Irql); - - ASSERT(NT_SUCCESS(status)); + if (!NT_SUCCESS(status)) + goto fail2; Response = StoreSubmitRequest(Context, &Request); status = STATUS_NO_MEMORY; if (Response == NULL) - goto fail2; + goto fail3; status = StoreCheckResponse(Response); if (!NT_SUCCESS(status)) - goto fail3; + goto fail4; (*Transaction)->Id = (uint32_t)strtoul(Response->Segment[XENBUS_STORE_RESPONSE_PAYLOAD_SEGMENT].Data, NULL, @@ -1623,12 +1623,15 @@ StoreTransactionStart( return STATUS_SUCCESS; -fail3: - Error("fail3\n"); +fail4: + Error("fail4\n"); StoreFreeResponse(Response); ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST))); +fail3: + Error("fail3\n"); + fail2: Error("fail2\n"); @@ -1677,17 +1680,18 @@ StoreTransactionEnd( KeReleaseSpinLock(&Context->Lock, Irql); - 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))); @@ -1711,12 +1715,19 @@ done: return status; -fail2: +fail3: + Error("fail3\n"); + ASSERT3U(status, !=, STATUS_RETRY); StoreFreeResponse(Response); +fail2: + Error("fail2\n"); + fail1: + Error("fail1 (%08x)\n", status); + ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST))); return status; @@ -1802,30 +1813,31 @@ StoreWatchAdd( KeReleaseSpinLock(&Context->Lock, Irql); - ASSERT(NT_SUCCESS(status)); + if (!NT_SUCCESS(status)) + goto fail4; Response = StoreSubmitRequest(Context, &Request); status = STATUS_NO_MEMORY; if (Response == NULL) - goto fail4; + goto fail5; status = StoreCheckResponse(Response); if (!NT_SUCCESS(status)) - goto fail5; + goto fail6; StoreFreeResponse(Response); ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST))); return STATUS_SUCCESS; -fail5: - Error("fail5\n"); +fail6: + Error("fail6\n"); StoreFreeResponse(Response); -fail4: - Error("fail4\n"); +fail5: + Error("fail5\n"); ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST))); @@ -1842,6 +1854,9 @@ fail4: __StoreFree(Path); +fail4: + Error("fail4\n"); + fail3: Error("fail3\n"); @@ -1906,17 +1921,18 @@ StoreWatchRemove( KeReleaseSpinLock(&Context->Lock, Irql); - 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)) - goto fail2; + goto fail3; StoreFreeResponse(Response); ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST))); @@ -1944,11 +1960,14 @@ done: return STATUS_SUCCESS; -fail2: - Error("fail2\n"); +fail3: + Error("fail3\n"); StoreFreeResponse(Response); +fail2: + Error("fail2\n"); + fail1: Error("fail1 (%08x)\n", status); -- 2.50.1.windows.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |