From: Amit Shah <amit.shah@redhat.com>
To: qemu-devel@nongnu.org
Cc: Amit Shah <amit.shah@redhat.com>
Subject: [Qemu-devel] [PATCH] qdev: Check if unplug handler exists before calling it
Date: Mon, 2 Nov 2009 14:56:41 +0530 [thread overview]
Message-ID: <1257154001-15403-1-git-send-email-amit.shah@redhat.com> (raw)
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>
---
hw/qdev.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/hw/qdev.c b/hw/qdev.c
index c7884d0..d19d531 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -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);
}
--
1.6.2.5
next reply other threads:[~2009-11-02 9:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-02 9:26 Amit Shah [this message]
2009-11-02 9:58 ` [Qemu-devel] [PATCH] qdev: Check if unplug handler exists before calling it Gerd Hoffmann
-- strict thread matches above, loose matches on Subject: below --
2009-11-02 6:27 Amit Shah
2009-11-02 9:18 ` Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1257154001-15403-1-git-send-email-amit.shah@redhat.com \
--to=amit.shah@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).