diff options
author | Amit Shah | 2009-11-02 10:26:41 +0100 |
---|---|---|
committer | Anthony Liguori | 2009-11-12 18:23:54 +0100 |
commit | 593831de5dce5f5b9ce1226e0d8353eecb1176e4 (patch) | |
tree | bbde500fae21a8563be891a4ef3b8cd7c5d2de46 /hw/qdev.c | |
parent | Makefile: Fix definition of pxe-*.bin blobs (diff) | |
download | qemu-593831de5dce5f5b9ce1226e0d8353eecb1176e4.tar.gz qemu-593831de5dce5f5b9ce1226e0d8353eecb1176e4.tar.xz qemu-593831de5dce5f5b9ce1226e0d8353eecb1176e4.zip |
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>
Diffstat (limited to 'hw/qdev.c')
-rw-r--r-- | hw/qdev.c | 2 |
1 files changed, 2 insertions, 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); } |