提交 98449371 编写于 作者: M Mark McLoughlin 提交者: Anthony Liguori

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: NMark McLoughlin <markmc@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 3706c43f
......@@ -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)
{
BusState *bus = opaque;
DeviceState *qdev;
DeviceState *qdev, *next;
PCIDevice *dev;
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);
if (PCI_SLOT(dev->devfn) == slot) {
#if defined (TARGET_I386)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册