|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] Avoid EINVAL from XenStore
XenStore Directory can return an empty string as the first element of
its buffer, which is converted into a 1 element array of (valid)
ANSI_STRINGs with length 0. When this 0 length string is passed to
XenStore Read, it attempts to read an invalid path (e.g. "~/drivers/")
which fails with EINVAL.
Add a check to skip 0 length strings in FdoClearDistribution.
Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
src/xenbus/fdo.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index 21de867..9c5decc 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -2606,6 +2606,11 @@ FdoClearDistribution(
for (Index = 0; Distributions[Index].Buffer != NULL; Index++) {
PANSI_STRING Distribution = &Distributions[Index];
+ // If ~/drivers has no children, an empty string could be returned.
+ // Note: Distribution->Buffer is 1 CHAR of "\0"
+ if (Distribution[Index].Length == 0)
+ continue;
+
status = XENBUS_STORE(Read,
&Fdo->StoreInterface,
NULL,
--
2.28.0.windows.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |