[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [XENVKBD PATCH] Fix FDO invalidation when no devices are present
On Wed, Jul 23, 2025 at 3:05 PM Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx> wrote:
__FdoEnumerate is called with Devices==NULL to signify that the entire
device xenstore key has been removed. However, the PdoIsMissing check
was under the Devices!=NULL check, and will never be called. This means
existing PDOs will never be validated in this situation.
Instead, always check for the PDO's existence even if Devices==NULL.
Fixes: 270cb87d3d2a ("Invalidate FDOs when no devices are present")
Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
This is rather untested, but the logic was rewritten to follow xenvif.
---
src/xenvkbd/fdo.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/src/xenvkbd/fdo.c b/src/xenvkbd/fdo.c
index 98297fc..12b8717 100644
--- a/src/xenvkbd/fdo.c
+++ b/src/xenvkbd/fdo.c
@@ -771,23 +771,23 @@ __FdoEnumerate(
break;
}
}
+ }
- if (!PdoIsMissing(Pdo)) {
- if (PdoIsEjectRequested(Pdo)) {
- IoRequestDeviceEject(PdoGetDeviceObject(Pdo));
- } else if (Missing) {
- PdoSetMissing(Pdo, "device disappeared");
-
- // If the PDO has not yet been enumerated then we can
- // go ahead and mark it as deleted, otherwise we need
- // to notify PnP manager and wait for the REMOVE_DEVICE
- // IRP.
- if (PdoGetDevicePnpState(Pdo) == Present) {
- PdoSetDevicePnpState(Pdo, Deleted);
- PdoDestroy(Pdo);
- } else {
- NeedInvalidate = TRUE;
- }
+ if (!PdoIsMissing(Pdo)) {
+ if (PdoIsEjectRequested(Pdo)) {
+ IoRequestDeviceEject(PdoGetDeviceObject(Pdo));
+ } else if (Missing) {
+ PdoSetMissing(Pdo, "device disappeared");
+
+ // If the PDO has not yet been enumerated then we can
+ // go ahead and mark it as deleted, otherwise we need
+ // to notify PnP manager and wait for the REMOVE_DEVICE
+ // IRP.
+ if (PdoGetDevicePnpState(Pdo) == Present) {
+ PdoSetDevicePnpState(Pdo, Deleted);
+ PdoDestroy(Pdo);
+ } else {
+ NeedInvalidate = TRUE;
}
}
}
--
2.50.0.windows.2
Ngoc Tu Dinh | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|