hotplug: safely iterate bus's sibling list while removing a device
Without this, I'm seeing a segfault when unpluging a NIC. Cc: Gerd Hoffmann <kraxel@redhat.com> Patchworks-ID: 35519 Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
3706c43f02
commit
9844937122
|
@ -695,11 +695,11 @@ static uint32_t pciej_read(void *opaque, uint32_t addr)
|
||||||
static void pciej_write(void *opaque, uint32_t addr, uint32_t val)
|
static void pciej_write(void *opaque, uint32_t addr, uint32_t val)
|
||||||
{
|
{
|
||||||
BusState *bus = opaque;
|
BusState *bus = opaque;
|
||||||
DeviceState *qdev;
|
DeviceState *qdev, *next;
|
||||||
PCIDevice *dev;
|
PCIDevice *dev;
|
||||||
int slot = ffs(val) - 1;
|
int slot = ffs(val) - 1;
|
||||||
|
|
||||||
QLIST_FOREACH(qdev, &bus->children, sibling) {
|
QLIST_FOREACH_SAFE(qdev, &bus->children, sibling, next) {
|
||||||
dev = DO_UPCAST(PCIDevice, qdev, qdev);
|
dev = DO_UPCAST(PCIDevice, qdev, qdev);
|
||||||
if (PCI_SLOT(dev->devfn) == slot) {
|
if (PCI_SLOT(dev->devfn) == slot) {
|
||||||
#if defined (TARGET_I386)
|
#if defined (TARGET_I386)
|
||||||
|
|
Loading…
Reference in New Issue