2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-11-19 16:14:13 +08:00
linux-next/drivers/virtio
Cornelia Huck 237242bddc virtio: Don't access index after unregister.
Virtio wants to release used indices after the corresponding
virtio device has been unregistered. However, virtio does not
hold an extra reference, giving up its last reference with
device_unregister(), making accessing dev->index afterwards
invalid.

I actually saw problems when testing my (not-yet-merged)
virtio-ccw code:

- device_add virtio-net,id=xxx
-> creates device virtio<n> with n>0

- device_del xxx
-> deletes virtio<n>, but calls ida_simple_remove with an
   index of 0

- device_add virtio-net,id=xxx
-> tries to add virtio0, which is still in use...

So let's save the index we want to release before calling
device_unregister().

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Cc: stable@kernel.org
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-11-09 14:54:24 +10:30
..
config.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
Kconfig virtio: remove CONFIG_VIRTIO_RING 2012-09-28 15:05:15 +09:30
Makefile virtio: remove CONFIG_VIRTIO_RING 2012-09-28 15:05:15 +09:30
virtio_balloon.c virtio-balloon: fix add/get API use 2012-07-09 09:07:22 +09:30
virtio_mmio.c virtio_mmio: Don't attempt to create empty virtqueues 2012-09-28 15:05:16 +09:30
virtio_pci.c drivers/virtio/virtio_pci.c: fix error return code 2012-09-28 15:05:16 +09:30
virtio_ring.c virtio-ring: move queue_index to vring_virtqueue 2012-09-28 15:05:15 +09:30
virtio.c virtio: Don't access index after unregister. 2012-11-09 14:54:24 +10:30