Re: [PATCH] virtio_input: reset device if input_register_device() fails

"Michael S. Tsirkin" <[email protected]> Wed, 5 Aug 2026 01:29:28 -0400
Newsgroups dev.linux.lists.virtualization,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <[email protected]>
On Wed, Aug 05, 2026 at 11:29:31AM +0800, Xiong Weimin wrote:
> Probe marks the device DRIVER_OK with virtio_device_ready() before
> calling input_register_device(). If registration fails, the error path
> cleared vi->ready and called del_vqs() while the device was still live,
> so the device could keep DMA to queues that were already torn down.
> 
> Match remove/freeze: call virtio_reset_device() on that path before
> tearing down the virtqueues.
> 
> Fixes: 271c865161c5 ("Add virtio-input driver.")
> Cc: [email protected]



for each of these patches: is this a real or a theoretical issue?
stable rules preclude the later kind.

> Signed-off-by: Xiong Weimin <[email protected]>
> ---
>  drivers/virtio/virtio_input.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/virtio/virtio_input.c b/drivers/virtio/virtio_input.c
> index deec24e8e..1a87be4c8 100644
> --- a/drivers/virtio/virtio_input.c
> +++ b/drivers/virtio/virtio_input.c
> @@ -331,6 +331,7 @@ static int virtinput_probe(struct virtio_device *vdev)
>  	spin_lock_irqsave(&vi->lock, flags);
>  	vi->ready = false;
>  	spin_unlock_irqrestore(&vi->lock, flags);
> +	virtio_reset_device(vdev);
>  err_mt_init_slots:
>  	input_free_device(vi->idev);
>  err_input_alloc:
> -- 
> 2.43.0