mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
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: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
88e2b0a5fd
commit
593831de5d
1 changed files with 2 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue