Commit b3b98a55 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 39171c86 df4198b1
...@@ -313,6 +313,7 @@ static int virtinput_probe(struct virtio_device *vdev) ...@@ -313,6 +313,7 @@ static int virtinput_probe(struct virtio_device *vdev)
static void virtinput_remove(struct virtio_device *vdev) static void virtinput_remove(struct virtio_device *vdev)
{ {
struct virtio_input *vi = vdev->priv; struct virtio_input *vi = vdev->priv;
void *buf;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&vi->lock, flags); spin_lock_irqsave(&vi->lock, flags);
...@@ -320,6 +321,9 @@ static void virtinput_remove(struct virtio_device *vdev) ...@@ -320,6 +321,9 @@ static void virtinput_remove(struct virtio_device *vdev)
spin_unlock_irqrestore(&vi->lock, flags); spin_unlock_irqrestore(&vi->lock, flags);
input_unregister_device(vi->idev); input_unregister_device(vi->idev);
vdev->config->reset(vdev);
while ((buf = virtqueue_detach_unused_buf(vi->sts)) != NULL)
kfree(buf);
vdev->config->del_vqs(vdev); vdev->config->del_vqs(vdev);
kfree(vi); kfree(vi);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment