From: Jason Wang <jasowang@redhat.com>
To: qemu-devel@nongnu.org, anthony@codemonkey.ws, mst@redhat.com
Subject: [Qemu-devel] [PATCH] monitor: properly handle invalid fd/vhostfd from command line
Date: Mon, 27 Sep 2010 15:52:44 +0800 [thread overview]
Message-ID: <20100927075244.8835.530.stgit@dhcp-91-7.nay.redhat.com.englab.nay.redhat.com> (raw)
monitor_get_fd() may also be used to parse fd or vhostfd from command line, so
we need to check whether the pointer of mon is NULL to avoid segmentation fault
when user pass invalid name of fd or vhostfd.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
monitor.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/monitor.c b/monitor.c
index e602480..5bb4ff0 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2345,6 +2345,10 @@ int monitor_get_fd(Monitor *mon, const char *fdname)
{
mon_fd_t *monfd;
+ if (mon == NULL) {
+ return -1;
+ }
+
QLIST_FOREACH(monfd, &mon->fds, next) {
int fd;
next reply other threads:[~2010-09-27 8:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-27 7:52 Jason Wang [this message]
2010-09-27 10:49 ` [Qemu-devel] Re: [PATCH] monitor: properly handle invalid fd/vhostfd from command line Michael S. Tsirkin
2010-09-28 14:53 ` [Qemu-devel] " Luiz Capitulino
2010-09-28 14:57 ` Michael S. Tsirkin
2010-10-08 17:40 ` Luiz Capitulino
2010-10-12 6:32 ` jason wang
2010-10-13 13:35 ` Luiz Capitulino
2010-10-14 2:21 ` Jason Wang
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=20100927075244.8835.530.stgit@dhcp-91-7.nay.redhat.com.englab.nay.redhat.com \
--to=jasowang@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=mst@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).