virtio: fix for 4.2

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.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJVxEFEAAoJECgfDbjSjVRpRLUH/3pwKkwvK8Hf7b9dhJX7HNQf
 8Kb+D95Ga/4fNOtmi03GDm6TrfS+sCocKEeTQ7KTm9KraoI61wOn9qsdIH+6HVRL
 Ear2fWp4gEZ7bS9n5XwY8AXUHzkbf+Xisg5pQxMex2qtFzEvNof2fD9ra883iLGQ
 T4IyAvxclcsiHEy5fxtYHskjKi1t+qxch8cstydaIHddW64TSJPwsbU3k1PQulM/
 pxueJRLwc5PvSCeIWiiNbiKNZ7oUtZO9LFwIGCrXESBEZ+YEhmNxK/J1CV6s8bNd
 fkuG+szgspl7lNv30NoYqa1RokMh1j8tx90POUwFYyyptK1u5mHOr06+BFr7C6g=
 =hz0N
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2015-08-08 04:36:40 +03:00
commit b3b98a551d

View file

@ -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);
}