qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012
@ 2012-01-06 15:51 Stefan Hajnoczi
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 1/9] qemu-options.hx: fix tls-channel help text Stefan Hajnoczi
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2012-01-06 15:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Stefan Hajnoczi

My pull request from 22 December 2011 was misformatted and therefore not
merged.  I have included those patches again together with the latest batch of
trivial patches.

The following changes since commit c47f3223658119219bbe0b8d09da733d1c06e76f:

  Merge remote-tracking branch 'pmaydell/arm-devs.for-upstream' into staging (2012-01-04 10:06:25 -0600)

are available in the git repository at:

  git://github.com/stefanha/qemu.git trivial-patches

Alon Levy (1):
      qemu-options.hx: fix tls-channel help text

Markus Armbruster (2):
      Strip trailing '\n' from error_report()'s first argument (again)
      scsi virtio-blk usb-msd: Clean up device init error messages

Peter Maydell (3):
      configure: Fix test for supported host CPU type
      gdbstub: Fix fd leak in gdbserver_open() error path
      net/socket.c: Fix fd leak in net_socket_listen_init() error paths

Sebastian Herbszt (1):
      Make python mandatory

Stefan Hajnoczi (1):
      qemu-nbd: drop loop which can never loop

Stefan Weil (1):
      configure: CONFIG_QEMU_INTERP_PREFIX only for user mode

 configure         |   56 +++++++++++++++++++++++-----------------------------
 gdbstub.c         |    2 +
 hw/scsi-disk.c    |    4 +-
 hw/scsi-generic.c |    8 +++---
 hw/usb-bus.c      |   12 +++++-----
 hw/usb-msd.c      |    2 +-
 hw/virtio-blk.c   |    2 +-
 net/socket.c      |    2 +
 qemu-nbd.c        |   10 +++-----
 qemu-options.hx   |    4 +-
 usb-redir.c       |    4 +-
 11 files changed, 51 insertions(+), 55 deletions(-)

-- 
1.7.7.3

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

* [Qemu-devel] [PATCH 1/9] qemu-options.hx: fix tls-channel help text
  2012-01-06 15:51 [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012 Stefan Hajnoczi
@ 2012-01-06 15:51 ` Stefan Hajnoczi
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 2/9] Strip trailing '\n' from error_report()'s first argument (again) Stefan Hajnoczi
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2012-01-06 15:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Alon Levy, Stefan Hajnoczi

From: Alon Levy <alevy@redhat.com>

Remove the default compiled out tunnel channel, add the always available
cursor channel. Optimally the man page would depend on compiled in
options, but that's harder to do.

RHBZ: 688586

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 qemu-options.hx |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index a60191f..3c3bda8 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -857,8 +857,8 @@ The x509 file names can also be configured individually.
 @item tls-ciphers=<list>
 Specify which ciphers to use.
 
-@item tls-channel=[main|display|inputs|record|playback|tunnel]
-@item plaintext-channel=[main|display|inputs|record|playback|tunnel]
+@item tls-channel=[main|display|cursor|inputs|record|playback]
+@item plaintext-channel=[main|display|cursor|inputs|record|playback]
 Force specific channel to be used with or without TLS encryption.  The
 options can be specified multiple times to configure multiple
 channels.  The special name "default" can be used to set the default
-- 
1.7.7.3

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

* [Qemu-devel] [PATCH 2/9] Strip trailing '\n' from error_report()'s first argument (again)
  2012-01-06 15:51 [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012 Stefan Hajnoczi
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 1/9] qemu-options.hx: fix tls-channel help text Stefan Hajnoczi
@ 2012-01-06 15:51 ` Stefan Hajnoczi
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 3/9] scsi virtio-blk usb-msd: Clean up device init error messages Stefan Hajnoczi
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2012-01-06 15:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Markus Armbruster

From: Markus Armbruster <armbru@redhat.com>

Commit 6daf194d got rid of them, but Hans and Gerd added some more
lately.  Tracked down with this Coccinelle semantic patch:

@r@
    expression fmt;
    position p;
@@
    error_report(fmt, ...)@p
@script:python@
    fmt << r.fmt;
    p << r.p;
@@
if "\\n" in str(fmt):
    print "%s:%s:%s:%s" % (p[0].file, p[0].line, p[0].column, fmt)

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/usb-bus.c |   12 ++++++------
 usb-redir.c  |    4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index 8203390..bd4afa7 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -137,7 +137,7 @@ USBDevice *usb_create(USBBus *bus, const char *name)
         bus = usb_bus_find(-1);
         if (!bus)
             return NULL;
-        error_report("%s: no bus specified, using \"%s\" for \"%s\"\n",
+        error_report("%s: no bus specified, using \"%s\" for \"%s\"",
                 __FUNCTION__, bus->qbus.name, name);
     }
 #endif
@@ -152,12 +152,12 @@ USBDevice *usb_create_simple(USBBus *bus, const char *name)
     int rc;
 
     if (!dev) {
-        error_report("Failed to create USB device '%s'\n", name);
+        error_report("Failed to create USB device '%s'", name);
         return NULL;
     }
     rc = qdev_init(&dev->qdev);
     if (rc < 0) {
-        error_report("Failed to initialize USB device '%s'\n", name);
+        error_report("Failed to initialize USB device '%s'", name);
         return NULL;
     }
     return dev;
@@ -244,7 +244,7 @@ int usb_claim_port(USBDevice *dev)
             }
         }
         if (port == NULL) {
-            error_report("Error: usb port %s (bus %s) not found (in use?)\n",
+            error_report("Error: usb port %s (bus %s) not found (in use?)",
                          dev->port_path, bus->qbus.name);
             return -1;
         }
@@ -255,7 +255,7 @@ int usb_claim_port(USBDevice *dev)
         }
         if (bus->nfree == 0) {
             error_report("Error: tried to attach usb device %s to a bus "
-                         "with no free ports\n", dev->product_desc);
+                         "with no free ports", dev->product_desc);
             return -1;
         }
         port = QTAILQ_FIRST(&bus->free);
@@ -302,7 +302,7 @@ int usb_device_attach(USBDevice *dev)
 
     if (!(port->speedmask & dev->speedmask)) {
         error_report("Warning: speed mismatch trying to attach "
-                     "usb device %s to bus %s\n",
+                     "usb device %s to bus %s",
                      dev->product_desc, bus->qbus.name);
         return -1;
     }
diff --git a/usb-redir.c b/usb-redir.c
index a36f2a7..2b53cf3 100644
--- a/usb-redir.c
+++ b/usb-redir.c
@@ -174,7 +174,7 @@ static void usbredir_log(void *priv, int level, const char *msg)
         return;
     }
 
-    error_report("%s\n", msg);
+    error_report("%s", msg);
 }
 
 static void usbredir_log_data(USBRedirDevice *dev, const char *desc,
@@ -193,7 +193,7 @@ static void usbredir_log_data(USBRedirDevice *dev, const char *desc,
         for (j = 0; j < 8 && i + j < len; j++) {
             n += sprintf(buf + n, " %02X", data[i + j]);
         }
-        error_report("%s\n", buf);
+        error_report("%s", buf);
     }
 }
 
-- 
1.7.7.3

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

* [Qemu-devel] [PATCH 3/9] scsi virtio-blk usb-msd: Clean up device init error messages
  2012-01-06 15:51 [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012 Stefan Hajnoczi
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 1/9] qemu-options.hx: fix tls-channel help text Stefan Hajnoczi
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 2/9] Strip trailing '\n' from error_report()'s first argument (again) Stefan Hajnoczi
@ 2012-01-06 15:51 ` Stefan Hajnoczi
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 4/9] configure: CONFIG_QEMU_INTERP_PREFIX only for user mode Stefan Hajnoczi
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2012-01-06 15:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Markus Armbruster, Stefan Hajnoczi

From: Markus Armbruster <armbru@redhat.com>

Replace

    error_report("DEVICE-NAME: MESSAGE");

by just

    error_report("MESSAGE");

in block device init functions.

DEVICE-NAME is bogus in some cases: it's "scsi-disk" for device
scsi-hd and scsi-cd, "virtio-blk-pci" for virtio-blk-s390, and
"usb-msd" for usb-storage.

There is no real need to put a device name in the message, because
error_report() points to the offending command line option already:

$ qemu-system-x86_64 --nodefaults --enable-kvm -vnc :0 -S -monitor stdio -usb -device virtio-blk-pci
upstream-qemu: -device virtio-blk-pci: virtio-blk-pci: drive property not set
upstream-qemu: -device virtio-blk-pci: Device 'virtio-blk-pci' could not be initialized

And for a monitor command, it's obvious anyway:

$ qemu-system-x86_64 --nodefaults --enable-kvm -vnc :0 -S -monitor stdio -usb
(qemu) device_add virtio-blk-pci
virtio-blk-pci: drive property not set
Device 'virtio-blk-pci' could not be initialized

Reported-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 hw/scsi-disk.c    |    4 ++--
 hw/scsi-generic.c |    8 ++++----
 hw/usb-msd.c      |    2 +-
 hw/virtio-blk.c   |    2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 505accd..5d8bf53 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -1515,7 +1515,7 @@ static int scsi_initfn(SCSIDevice *dev)
     DriveInfo *dinfo;
 
     if (!s->qdev.conf.bs) {
-        error_report("scsi-disk: drive property not set");
+        error_report("drive property not set");
         return -1;
     }
 
@@ -1537,7 +1537,7 @@ static int scsi_initfn(SCSIDevice *dev)
     }
 
     if (bdrv_is_sg(s->qdev.conf.bs)) {
-        error_report("scsi-disk: unwanted /dev/sg*");
+        error_report("unwanted /dev/sg*");
         return -1;
     }
 
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index 6f7d3db..0aebcdd 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -374,13 +374,13 @@ static int scsi_generic_initfn(SCSIDevice *s)
     struct sg_scsi_id scsiid;
 
     if (!s->conf.bs) {
-        error_report("scsi-generic: drive property not set");
+        error_report("drive property not set");
         return -1;
     }
 
     /* check we are really using a /dev/sg* file */
     if (!bdrv_is_sg(s->conf.bs)) {
-        error_report("scsi-generic: not /dev/sg*");
+        error_report("not /dev/sg*");
         return -1;
     }
 
@@ -396,13 +396,13 @@ static int scsi_generic_initfn(SCSIDevice *s)
     /* check we are using a driver managing SG_IO (version 3 and after */
     if (bdrv_ioctl(s->conf.bs, SG_GET_VERSION_NUM, &sg_version) < 0 ||
         sg_version < 30000) {
-        error_report("scsi-generic: scsi generic interface too old");
+        error_report("scsi generic interface too old");
         return -1;
     }
 
     /* get LUN of the /dev/sg? */
     if (bdrv_ioctl(s->conf.bs, SG_GET_SCSI_ID, &scsiid)) {
-        error_report("scsi-generic: SG_GET_SCSI_ID ioctl failed");
+        error_report("SG_GET_SCSI_ID ioctl failed");
         return -1;
     }
 
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 4c06950..b87b929 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -517,7 +517,7 @@ static int usb_msd_initfn(USBDevice *dev)
     DriveInfo *dinfo;
 
     if (!bs) {
-        error_report("usb-msd: drive property not set");
+        error_report("drive property not set");
         return -1;
     }
 
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index ef27421..5e81f53 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -569,7 +569,7 @@ VirtIODevice *virtio_blk_init(DeviceState *dev, BlockConf *conf,
     DriveInfo *dinfo;
 
     if (!conf->bs) {
-        error_report("virtio-blk-pci: drive property not set");
+        error_report("drive property not set");
         return NULL;
     }
     if (!bdrv_is_inserted(conf->bs)) {
-- 
1.7.7.3

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

* [Qemu-devel] [PATCH 4/9] configure: CONFIG_QEMU_INTERP_PREFIX only for user mode
  2012-01-06 15:51 [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012 Stefan Hajnoczi
                   ` (2 preceding siblings ...)
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 3/9] scsi virtio-blk usb-msd: Clean up device init error messages Stefan Hajnoczi
@ 2012-01-06 15:51 ` Stefan Hajnoczi
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 5/9] configure: Fix test for supported host CPU type Stefan Hajnoczi
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2012-01-06 15:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Weil, Anthony Liguori, Stefan Hajnoczi

From: Stefan Weil <sw@weilnetz.de>

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 configure |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index 640e815..af19391 100755
--- a/configure
+++ b/configure
@@ -3395,7 +3395,6 @@ echo "# Automatically generated by configure - do not modify" > $config_target_m
 bflt="no"
 target_nptl="no"
 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
-echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
 gdb_xml_files=""
 target_short_alignment=2
 target_int_alignment=4
@@ -3601,6 +3600,7 @@ if test "$target_softmmu" = "yes" ; then
 fi
 if test "$target_user_only" = "yes" ; then
   echo "CONFIG_USER_ONLY=y" >> $config_target_mak
+  echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
 fi
 if test "$target_linux_user" = "yes" ; then
   echo "CONFIG_LINUX_USER=y" >> $config_target_mak
-- 
1.7.7.3

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

* [Qemu-devel] [PATCH 5/9] configure: Fix test for supported host CPU type
  2012-01-06 15:51 [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012 Stefan Hajnoczi
                   ` (3 preceding siblings ...)
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 4/9] configure: CONFIG_QEMU_INTERP_PREFIX only for user mode Stefan Hajnoczi
@ 2012-01-06 15:51 ` Stefan Hajnoczi
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 6/9] gdbstub: Fix fd leak in gdbserver_open() error path Stefan Hajnoczi
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2012-01-06 15:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Anthony Liguori, Stefan Hajnoczi

From: Peter Maydell <peter.maydell@linaro.org>

The test for whether the host CPU is supported had several problems:
 * the attempt to fall back to TCI was done as a duplicate
   test, very late (so "--cpu foo" would fail early but "--cpu unicore32"
   would fail late, differently, and after configure had already
   printed a lot of output)
 * a number of CPUs only supported as guests were included in the
   list of CPUs we would accept as valid hosts, which would result
   in a late compile failure on those systems rather than a
   configure failure or fallback to TCI
 * bailing out for an unsupported CPU happened before the main
   option parsing, so "configure --help" wouldn't work

Fix these by folding the setting of ARCH into the first test for
supported host CPU, removing spurious guest-only CPU names from it,
and moving the "fall back to TCI" code earlier.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 configure |   44 +++++++++++++++++++++-----------------------
 1 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/configure b/configure
index af19391..a1394eb 100755
--- a/configure
+++ b/configure
@@ -300,8 +300,11 @@ else
   cpu=`uname -m`
 fi
 
+ARCH=
+# Normalise host CPU name and set ARCH.
+# Note that this case should only have supported host CPUs, not guests.
 case "$cpu" in
-  alpha|cris|ia64|lm32|m68k|microblaze|ppc|ppc64|sparc64|unicore32)
+  ia64|ppc|ppc64|s390|s390x|sparc64)
     cpu="$cpu"
   ;;
   i386|i486|i586|i686|i86pc|BePC)
@@ -319,20 +322,17 @@ case "$cpu" in
   mips*)
     cpu="mips"
   ;;
-  s390)
-    cpu="s390"
-  ;;
-  s390x)
-    cpu="s390x"
-  ;;
   sparc|sun4[cdmuv])
     cpu="sparc"
   ;;
   *)
-    echo "Unsupported CPU = $cpu"
-    exit 1
+    # This will result in either an error or falling back to TCI later
+    ARCH=unknown
   ;;
 esac
+if test -z "$ARCH"; then
+  ARCH="$cpu"
+fi
 
 # OS specific
 if check_define __linux__ ; then
@@ -1080,6 +1080,18 @@ echo "NOTE: The object files are built at the place where configure is launched"
 exit 1
 fi
 
+# Now we have handled --enable-tcg-interpreter and know we're not just
+# printing the help message, bail out if the host CPU isn't supported.
+if test "$ARCH" = "unknown"; then
+    if test "$tcg_interpreter" = "yes" ; then
+        echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
+        ARCH=tci
+    else
+        echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
+        exit 1
+    fi
+fi
+
 # check that the C compiler works.
 cat > $TMPC <<EOF
 int main(void) { return 0; }
@@ -2903,20 +2915,6 @@ echo "sysconfdir=$sysconfdir" >> $config_host_mak
 echo "docdir=$docdir" >> $config_host_mak
 echo "confdir=$confdir" >> $config_host_mak
 
-case "$cpu" in
-  i386|x86_64|alpha|arm|cris|hppa|ia64|lm32|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64|unicore32)
-    ARCH=$cpu
-  ;;
-  *)
-    if test "$tcg_interpreter" = "yes" ; then
-        echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
-        ARCH=tci
-    else
-        echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
-        exit 1
-    fi
-  ;;
-esac
 echo "ARCH=$ARCH" >> $config_host_mak
 if test "$debug_tcg" = "yes" ; then
   echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
-- 
1.7.7.3

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

* [Qemu-devel] [PATCH 6/9] gdbstub: Fix fd leak in gdbserver_open() error path
  2012-01-06 15:51 [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012 Stefan Hajnoczi
                   ` (4 preceding siblings ...)
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 5/9] configure: Fix test for supported host CPU type Stefan Hajnoczi
@ 2012-01-06 15:51 ` Stefan Hajnoczi
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 7/9] net/socket.c: Fix fd leak in net_socket_listen_init() error paths Stefan Hajnoczi
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2012-01-06 15:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Anthony Liguori, Stefan Hajnoczi

From: Peter Maydell <peter.maydell@linaro.org>

Fix a leak of a file descriptor in error exit paths in
gdbserver_open().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 gdbstub.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/gdbstub.c b/gdbstub.c
index a5806ef..7d470b6 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2762,11 +2762,13 @@ static int gdbserver_open(int port)
     ret = bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr));
     if (ret < 0) {
         perror("bind");
+        close(fd);
         return -1;
     }
     ret = listen(fd, 0);
     if (ret < 0) {
         perror("listen");
+        close(fd);
         return -1;
     }
     return fd;
-- 
1.7.7.3

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

* [Qemu-devel] [PATCH 7/9] net/socket.c: Fix fd leak in net_socket_listen_init() error paths
  2012-01-06 15:51 [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012 Stefan Hajnoczi
                   ` (5 preceding siblings ...)
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 6/9] gdbstub: Fix fd leak in gdbserver_open() error path Stefan Hajnoczi
@ 2012-01-06 15:51 ` Stefan Hajnoczi
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 8/9] Make python mandatory Stefan Hajnoczi
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2012-01-06 15:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Anthony Liguori, Stefan Hajnoczi

From: Peter Maydell <peter.maydell@linaro.org>

Fix a leak of a file descriptor due to missing closesocket() calls
in error paths in net_socket_listen_init().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 net/socket.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index aaf9be4..c9d70d3 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -427,12 +427,14 @@ static int net_socket_listen_init(VLANState *vlan,
     if (ret < 0) {
         perror("bind");
         g_free(s);
+        closesocket(fd);
         return -1;
     }
     ret = listen(fd, 0);
     if (ret < 0) {
         perror("listen");
         g_free(s);
+        closesocket(fd);
         return -1;
     }
     s->vlan = vlan;
-- 
1.7.7.3

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

* [Qemu-devel] [PATCH 8/9] Make python mandatory
  2012-01-06 15:51 [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012 Stefan Hajnoczi
                   ` (6 preceding siblings ...)
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 7/9] net/socket.c: Fix fd leak in net_socket_listen_init() error paths Stefan Hajnoczi
@ 2012-01-06 15:51 ` Stefan Hajnoczi
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 9/9] qemu-nbd: drop loop which can never loop Stefan Hajnoczi
  2012-01-09 14:51 ` [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012 Anthony Liguori
  9 siblings, 0 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2012-01-06 15:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Stefan Hajnoczi, Sebastian Herbszt

From: Sebastian Herbszt <herbszt@gmx.de>

The QEMU build depends on Python so make it an explicit requirement.

Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 configure |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index a1394eb..d88e3ea 100755
--- a/configure
+++ b/configure
@@ -1197,13 +1197,9 @@ if test "$solaris" = "yes" ; then
   fi
 fi
 
-if test "$guest_agent" != "no" ; then
-  if has $python; then
-    :
-  else
-    echo "Python not found. Use --python=/path/to/python"
-    exit 1
-  fi
+if ! has $python; then
+  echo "Python not found. Use --python=/path/to/python"
+  exit 1
 fi
 
 if test -z "$target_list" ; then
-- 
1.7.7.3

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

* [Qemu-devel] [PATCH 9/9] qemu-nbd: drop loop which can never loop
  2012-01-06 15:51 [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012 Stefan Hajnoczi
                   ` (7 preceding siblings ...)
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 8/9] Make python mandatory Stefan Hajnoczi
@ 2012-01-06 15:51 ` Stefan Hajnoczi
  2012-01-09 14:51 ` [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012 Anthony Liguori
  9 siblings, 0 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2012-01-06 15:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Stefan Hajnoczi

For some reason nbd_client_thread() has a do..while loop which can never
loop, the condition is bogus because we would take a goto instead.  Drop
the loop.

Reported-by: Dr David Alan Gilbert <davidagilbert@uk.ibm.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 qemu-nbd.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/qemu-nbd.c b/qemu-nbd.c
index 155b058..eb61c33 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -202,12 +202,10 @@ static void *nbd_client_thread(void *arg)
     int ret;
     pthread_t show_parts_thread;
 
-    do {
-        sock = unix_socket_outgoing(sockpath);
-        if (sock == -1) {
-            goto out;
-        }
-    } while (sock == -1);
+    sock = unix_socket_outgoing(sockpath);
+    if (sock == -1) {
+        goto out;
+    }
 
     ret = nbd_receive_negotiate(sock, NULL, &nbdflags,
                                 &size, &blocksize);
-- 
1.7.7.3

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

* Re: [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012
  2012-01-06 15:51 [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012 Stefan Hajnoczi
                   ` (8 preceding siblings ...)
  2012-01-06 15:51 ` [Qemu-devel] [PATCH 9/9] qemu-nbd: drop loop which can never loop Stefan Hajnoczi
@ 2012-01-09 14:51 ` Anthony Liguori
  9 siblings, 0 replies; 11+ messages in thread
From: Anthony Liguori @ 2012-01-09 14:51 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel

On 01/06/2012 09:51 AM, Stefan Hajnoczi wrote:
> My pull request from 22 December 2011 was misformatted and therefore not
> merged.  I have included those patches again together with the latest batch of
> trivial patches.
>
> The following changes since commit c47f3223658119219bbe0b8d09da733d1c06e76f:
>
>    Merge remote-tracking branch 'pmaydell/arm-devs.for-upstream' into staging (2012-01-04 10:06:25 -0600)

Pulled a couple days ago and forgot to send a note.  Thanks.

Regards,

Anthony Liguori

>
> are available in the git repository at:
>
>    git://github.com/stefanha/qemu.git trivial-patches
>
> Alon Levy (1):
>        qemu-options.hx: fix tls-channel help text
>
> Markus Armbruster (2):
>        Strip trailing '\n' from error_report()'s first argument (again)
>        scsi virtio-blk usb-msd: Clean up device init error messages
>
> Peter Maydell (3):
>        configure: Fix test for supported host CPU type
>        gdbstub: Fix fd leak in gdbserver_open() error path
>        net/socket.c: Fix fd leak in net_socket_listen_init() error paths
>
> Sebastian Herbszt (1):
>        Make python mandatory
>
> Stefan Hajnoczi (1):
>        qemu-nbd: drop loop which can never loop
>
> Stefan Weil (1):
>        configure: CONFIG_QEMU_INTERP_PREFIX only for user mode
>
>   configure         |   56 +++++++++++++++++++++++-----------------------------
>   gdbstub.c         |    2 +
>   hw/scsi-disk.c    |    4 +-
>   hw/scsi-generic.c |    8 +++---
>   hw/usb-bus.c      |   12 +++++-----
>   hw/usb-msd.c      |    2 +-
>   hw/virtio-blk.c   |    2 +-
>   net/socket.c      |    2 +
>   qemu-nbd.c        |   10 +++-----
>   qemu-options.hx   |    4 +-
>   usb-redir.c       |    4 +-
>   11 files changed, 51 insertions(+), 55 deletions(-)
>

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

end of thread, other threads:[~2012-01-09 14:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-06 15:51 [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012 Stefan Hajnoczi
2012-01-06 15:51 ` [Qemu-devel] [PATCH 1/9] qemu-options.hx: fix tls-channel help text Stefan Hajnoczi
2012-01-06 15:51 ` [Qemu-devel] [PATCH 2/9] Strip trailing '\n' from error_report()'s first argument (again) Stefan Hajnoczi
2012-01-06 15:51 ` [Qemu-devel] [PATCH 3/9] scsi virtio-blk usb-msd: Clean up device init error messages Stefan Hajnoczi
2012-01-06 15:51 ` [Qemu-devel] [PATCH 4/9] configure: CONFIG_QEMU_INTERP_PREFIX only for user mode Stefan Hajnoczi
2012-01-06 15:51 ` [Qemu-devel] [PATCH 5/9] configure: Fix test for supported host CPU type Stefan Hajnoczi
2012-01-06 15:51 ` [Qemu-devel] [PATCH 6/9] gdbstub: Fix fd leak in gdbserver_open() error path Stefan Hajnoczi
2012-01-06 15:51 ` [Qemu-devel] [PATCH 7/9] net/socket.c: Fix fd leak in net_socket_listen_init() error paths Stefan Hajnoczi
2012-01-06 15:51 ` [Qemu-devel] [PATCH 8/9] Make python mandatory Stefan Hajnoczi
2012-01-06 15:51 ` [Qemu-devel] [PATCH 9/9] qemu-nbd: drop loop which can never loop Stefan Hajnoczi
2012-01-09 14:51 ` [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012 Anthony Liguori

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