Skip to content

Commit b3b98a5

Browse files
committed
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Pull virtio fix from Michael Tsirkin: "A last minute fix for the new virtio input driver. It seems pretty obvious, and the problem it's fixing would be quite hard to debug" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: virtio-input: reset device and detach unused during remove
2 parents 39171c8 + df4198b commit b3b98a5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/virtio/virtio_input.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,13 +313,17 @@ static int virtinput_probe(struct virtio_device *vdev)
313313
static void virtinput_remove(struct virtio_device *vdev)
314314
{
315315
struct virtio_input *vi = vdev->priv;
316+
void *buf;
316317
unsigned long flags;
317318

318319
spin_lock_irqsave(&vi->lock, flags);
319320
vi->ready = false;
320321
spin_unlock_irqrestore(&vi->lock, flags);
321322

322323
input_unregister_device(vi->idev);
324+
vdev->config->reset(vdev);
325+
while ((buf = virtqueue_detach_unused_buf(vi->sts)) != NULL)
326+
kfree(buf);
323327
vdev->config->del_vqs(vdev);
324328
kfree(vi);
325329
}

0 commit comments

Comments
 (0)