提交 593831de 编写于 作者: A Amit Shah 提交者: Anthony Liguori

qdev: Check if unplug handler exists before calling it

A bus may have hotplugging enabled but not have the 'unplug'
callback defined, which would lead to a crash on trying to
unplug a device on the bus.

Fix by introducing an assert to check if the callback is valid.
Signed-off-by: NAmit Shah <amit.shah@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 88e2b0a5
......@@ -258,6 +258,8 @@ int qdev_unplug(DeviceState *dev)
dev->parent_bus->name);
return -1;
}
assert(dev->info->unplug != NULL);
return dev->info->unplug(dev);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册