qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] monitor: properly handle invalid fd/vhostfd from command line
@ 2010-09-27  7:52 Jason Wang
  2010-09-27 10:49 ` [Qemu-devel] " Michael S. Tsirkin
  2010-09-28 14:53 ` [Qemu-devel] " Luiz Capitulino
  0 siblings, 2 replies; 8+ messages in thread
From: Jason Wang @ 2010-09-27  7:52 UTC (permalink / raw)
  To: qemu-devel, anthony, mst

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;
 

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-10-14  2:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-27  7:52 [Qemu-devel] [PATCH] monitor: properly handle invalid fd/vhostfd from command line Jason Wang
2010-09-27 10:49 ` [Qemu-devel] " 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

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).