summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-08-08 04:36:40 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2015-08-08 04:36:40 +0300
commitb3b98a551de18c7983e63ade9490fe52b9bbee6f (patch)
treef53b15f5709572d35a707482b57c52bec82941cb /drivers
parent39171c86f1c47320de51796d58eb7a5533135a4a (diff)
parentdf4198b1e0c4a7d1adde1e5c2ceb67ac10b391bb (diff)
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
Diffstat (limited to 'drivers')
-rw-r--r--drivers/virtio/virtio_input.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/virtio/virtio_input.c b/drivers/virtio/virtio_input.c
index 60e2a1677563..c96944b59856 100644
--- a/drivers/virtio/virtio_input.c
+++ b/drivers/virtio/virtio_input.c
@@ -313,6 +313,7 @@ err_init_vq:
static void virtinput_remove(struct virtio_device *vdev)
{
struct virtio_input *vi = vdev->priv;
+ void *buf;
unsigned long flags;
spin_lock_irqsave(&vi->lock, flags);
@@ -320,6 +321,9 @@ static void virtinput_remove(struct virtio_device *vdev)
spin_unlock_irqrestore(&vi->lock, flags);
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);
kfree(vi);
}