|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] xenfilt: Complete enumeration for empty BusRelations
On 24/11/2026 10:34, Jiaqing Zhao wrote:
> A successful BusRelations query may return no PDOs if no device is
> present on that bus. Skipping FdoEnumerate() in that case leaves the
> XenFilt FDO marked as not enumerated, so the filter state never moves
> from XENFILT_FILTER_ENABLED to PENDING. On an HVM guest with a PV disk
> and a CD-ROM on secondary IDE channel (leaving the primary channel
> empty), this blocks XenVbd and the guest fails to boot.
>
> Always call FdoEnumerate() so that tracked PDOs are reconciled and the
> FDO is marked enumerated even when the bus is empty.
>
> Signed-off-by: Jiaqing Zhao <Zhao.Jiaqing@xxxxxxx>
Reviewed-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
> ---
> Cc: Owen Smith <owen.smith@xxxxxxxxxx>
> Cc: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
> ---
> src/xenfilt/fdo.c | 28 ++++++++++++++++------------
> 1 file changed, 16 insertions(+), 12 deletions(-)
>
> diff --git a/src/xenfilt/fdo.c b/src/xenfilt/fdo.c
> index 04427bf..c8d98c6 100644
> --- a/src/xenfilt/fdo.c
> +++ b/src/xenfilt/fdo.c
> @@ -409,17 +409,20 @@ FdoEnumerate(
> NTSTATUS status;
>
> Count = Relations->Count;
> - ASSERT(Count != 0);
> + PhysicalDeviceObject = NULL;
> + if (Count != 0) {
> + PhysicalDeviceObject = __FdoAllocate(sizeof (PDEVICE_OBJECT) *
> Count);
>
> - PhysicalDeviceObject = __FdoAllocate(sizeof (PDEVICE_OBJECT) * Count);
> -
> - status = STATUS_NO_MEMORY;
> - if (PhysicalDeviceObject == NULL)
> - goto fail1;
> + status = STATUS_NO_MEMORY;
> + if (PhysicalDeviceObject == NULL)
> + goto fail1;
>
> - RtlCopyMemory(PhysicalDeviceObject,
> - Relations->Objects,
> - sizeof (PDEVICE_OBJECT) * Count);
> + RtlCopyMemory(PhysicalDeviceObject,
> + Relations->Objects,
> + sizeof (PDEVICE_OBJECT) * Count);
> + } else {
> + Info("%s: Enumerated empty BusRelations\n", __FdoGetName(Fdo));
> + }
>
> // Remove any PDOs that do not appear in the device list
> ListEntry = Fdo->List.Flink;
> @@ -498,7 +501,8 @@ FdoEnumerate(
>
> __FdoSetEnumerated(Fdo);
>
> - __FdoFree(PhysicalDeviceObject);
> + if (PhysicalDeviceObject != NULL)
> + __FdoFree(PhysicalDeviceObject);
> return;
>
> fail1:
> @@ -942,10 +946,10 @@ FdoQueryDeviceRelations(
>
> Relations = (PDEVICE_RELATIONS)Irp->IoStatus.Information;
>
> - if (Relations->Count != 0)
> - FdoEnumerate(Fdo, Relations);
> + FdoEnumerate(Fdo, Relations);
>
> ExFreePool(Relations);
> + Irp->IoStatus.Information = 0;
>
> State = DriverGetFilterState();
> Count = 0;
--
Ngoc Tu Dinh | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |