Re: [PATCH v2] virtio-mem: only mark the device ready in kdump mode with vmcore support

From: David Hildenbrand (Arm)

Date: Tue Nov 03 2026 - 03:02:38 EST


On 11/2/26 21:35, Yuho Choi wrote:
> virtio_mem_init_kdump() marks the device DRIVER_OK before it checks for
> CONFIG_PROC_VMCORE. Without vmcore support it then fails with -EBUSY,
> and virtio_mem_probe() deletes the virtqueue on that error path without
> resetting the device first. The device is left with DRIVER_OK set and a
> queue that points at freed memory. Nothing has been queued at that
> point, so the device has nothing to process, but the driver should not
> leave a device it is giving up on marked ready.
>
> Before commit a9403425b3cf ("virtio-mem: mark device ready before
> registering callbacks in kdump mode"), virtio_mem_probe() called
> virtio_device_ready() only after virtio_mem_init() had succeeded, so this
> path never exposed a ready device.
>
> Move virtio_device_ready() into the CONFIG_PROC_VMCORE branch, right
> before the vmcore callbacks that need it are registered, so the -EBUSY
> path never sets DRIVER_OK.
>
> Fixes: a9403425b3cf ("virtio-mem: mark device ready before registering callbacks in kdump mode")
> Signed-off-by: Yuho Choi <oss.patchbox@xxxxxxxxx>
> ---

Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>

--
Cheers,

David