]> git.baikalelectronics.ru Git - kernel.git/commit
virtio_pci: fix use after free on release
authorMichael S. Tsirkin <mst@redhat.com>
Thu, 14 Jan 2016 14:00:41 +0000 (16:00 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 26 Jan 2016 08:18:28 +0000 (10:18 +0200)
commit90523cf8d95f5c18e36ed7b3e32cb655edb165bc
tree91fc1b8002e4c9868d0e692dd6b4039e965c9a36
parentd7e15052ecc9ac4f938d1d7432c1d120a2711a7e
virtio_pci: fix use after free on release

KASan detected a use-after-free error in virtio-pci remove code. In
virtio_pci_remove(), vp_dev is still used after being freed in
unregister_virtio_device() (in virtio_pci_release_dev() more
precisely).

To fix, keep a reference until cleanup is done.

Fixes: 20606b4b43ae ("virtio_pci: defer kfree until release callback")
Reported-by: Jerome Marchand <jmarchan@redhat.com>
Cc: stable@vger.kernel.org
Cc: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Jerome Marchand <jmarchan@redhat.com>
drivers/virtio/virtio_pci_common.c