[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] Fail XS_DIRECTORY for paths with no children
When a xenstore path has no children, a response is generated which contians only the double null terminator. Detect a 0-length response payload and return STATUS_OBJECT_PATH_NOT_FOUND to indicate that this path does not have any children Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx> --- src/xenbus/store.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/xenbus/store.c b/src/xenbus/store.c index cbc442e..570b8b5 100644 --- a/src/xenbus/store.c +++ b/src/xenbus/store.c @@ -115,6 +115,7 @@ typedef struct _XENBUS_STORE_REQUEST { typedef struct _XENBUS_STORE_BUFFER { LIST_ENTRY ListEntry; ULONG Magic; + ULONG Length; PVOID Caller; CHAR Data[1]; } XENBUS_STORE_BUFFER, *PXENBUS_STORE_BUFFER; @@ -1036,6 +1037,7 @@ StoreCopyPayload( goto fail1; Buffer->Magic = XENBUS_STORE_BUFFER_MAGIC; + Buffer->Length = Length; Buffer->Caller = Caller; RtlCopyMemory(Buffer->Data, Data, Length); @@ -1044,7 +1046,7 @@ StoreCopyPayload( InsertTailList(&Context->BufferList, &Buffer->ListEntry); KeReleaseSpinLock(&Context->Lock, Irql); - return Buffer; + return Buffer; fail1: Error("fail1 (%08x)\n", status); @@ -1439,6 +1441,10 @@ StoreDirectory( if (Buffer == NULL) goto fail4; + status = STATUS_OBJECT_PATH_NOT_FOUND; + if (Buffer->Length == 0) + goto fail5; + StoreFreeResponse(Response); ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST))); @@ -1446,6 +1452,9 @@ StoreDirectory( return STATUS_SUCCESS; +fail5: + StoreFreePayload(Context, Buffer); + fail4: fail3: StoreFreeResponse(Response); -- 2.28.0.windows.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |