All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/4] Fixes 20200713 patches
@ 2020-07-13 14:10 Gerd Hoffmann
  2020-07-13 14:10 ` [PULL 1/4] ossaudio: fix out of bounds write Gerd Hoffmann
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Gerd Hoffmann @ 2020-07-13 14:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Daniel P. Berrangé, Gerd Hoffmann, Eduardo Habkost

The following changes since commit 9f526fce49c6ac48114ed04914b5a76e4db75785:

  Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-and-misc-110720-2' into staging (2020-07-12 15:32:05 +0100)

are available in the Git repository at:

  git://git.kraxel.org/qemu tags/fixes-20200713-pull-request

for you to fetch changes up to 631009e775a91018a62e2670b4473e99916f858f:

  usb: fix usb-host build on windows. (2020-07-13 11:46:51 +0200)

----------------------------------------------------------------
bugfixes for audio, usb, ui and docs.

----------------------------------------------------------------

Gerd Hoffmann (2):
  ui: fix vc_chr_write call in text_console_do_init
  usb: fix usb-host build on windows.

Thomas Huth (1):
  docs/qdev-device-use: Clean up the sentences related to -usbdevice

Volker Rümelin (1):
  ossaudio: fix out of bounds write

 docs/qdev-device-use.txt | 28 +++-------------------------
 audio/ossaudio.c         |  1 +
 hw/usb/host-libusb.c     |  4 ++--
 ui/console.c             |  8 ++++----
 4 files changed, 10 insertions(+), 31 deletions(-)

-- 
2.18.4



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

* [PULL 1/4] ossaudio: fix out of bounds write
  2020-07-13 14:10 [PULL 0/4] Fixes 20200713 patches Gerd Hoffmann
@ 2020-07-13 14:10 ` Gerd Hoffmann
  2020-07-13 14:10 ` [PULL 2/4] docs/qdev-device-use: Clean up the sentences related to -usbdevice Gerd Hoffmann
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Gerd Hoffmann @ 2020-07-13 14:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Volker Rümelin, Daniel P. Berrangé,
	Gerd Hoffmann, Eduardo Habkost

From: Volker Rümelin <vr_qemu@t-online.de>

In function oss_read() a read error currently does not exit the
read loop. With no data to read the variable pos will quickly
underflow and a subsequent successful read overwrites memory
outside the buffer. This patch adds the missing break statement
to the error path of the function.

To reproduce start qemu with -audiodev oss,id=audio0 and in the
guest start audio recording. After some time this will trigger
an exception.

Fixes: 3ba4066d08 "ossaudio: port to the new audio backend api"

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 20200707180836.5435-1-vr_qemu@t-online.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 audio/ossaudio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index f88d076ec236..a7dcaa31adeb 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -691,6 +691,7 @@ static size_t oss_read(HWVoiceIn *hw, void *buf, size_t len)
                            len, dst);
                 break;
             }
+            break;
         }
 
         pos += nread;
-- 
2.18.4



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

* [PULL 2/4] docs/qdev-device-use: Clean up the sentences related to -usbdevice
  2020-07-13 14:10 [PULL 0/4] Fixes 20200713 patches Gerd Hoffmann
  2020-07-13 14:10 ` [PULL 1/4] ossaudio: fix out of bounds write Gerd Hoffmann
@ 2020-07-13 14:10 ` Gerd Hoffmann
  2020-07-13 14:14   ` Peter Maydell
  2020-07-13 14:10 ` [PULL 3/4] ui: fix vc_chr_write call in text_console_do_init Gerd Hoffmann
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Gerd Hoffmann @ 2020-07-13 14:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Thomas Huth, Daniel P. Berrangé,
	Gerd Hoffmann, Eduardo Habkost

From: Thomas Huth <thuth@redhat.com>

Most of the -usbdevice paramaters have been removed already. Update
the doc accordingly.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-id: 20200710065520.24784-1-thuth@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 docs/qdev-device-use.txt | 28 +++-------------------------
 1 file changed, 3 insertions(+), 25 deletions(-)

diff --git a/docs/qdev-device-use.txt b/docs/qdev-device-use.txt
index 4bbbcf561f2f..f8d0d2fe297a 100644
--- a/docs/qdev-device-use.txt
+++ b/docs/qdev-device-use.txt
@@ -125,12 +125,7 @@ The -device argument differs in detail for each type of drive:
 
 * if=pflash, if=mtd, if=sd, if=xen are not yet available with -device
 
-For USB devices, the old way is actually different:
-
-    -usbdevice disk:format=FMT:FILENAME
-
-Provides much less control than -drive's OPTS...  The new way fixes
-that:
+For USB storage devices, you can use something like:
 
     -device usb-storage,drive=DRIVE-ID,removable=RMB
 
@@ -177,8 +172,6 @@ The appropriate DEVNAME depends on the machine type.  For type "pc":
 
   This lets you control I/O ports and IRQs.
 
-* -usbdevice serial::chardev becomes -device usb-serial,chardev=dev.
-
 * -usbdevice braille doesn't support LEGACY-CHARDEV syntax.  It always
   uses "braille".  With -device, this useful default is gone, so you
   have to use something like
@@ -238,10 +231,6 @@ The old way to define the guest part looks like this:
 
     -net nic,netdev=NET-ID,macaddr=MACADDR,model=MODEL,name=ID,addr=STR,vectors=V
 
-Except for USB it looks like this:
-
-    -usbdevice net:netdev=NET-ID,macaddr=MACADDR,name=ID
-
 The new way is -device:
 
     -device DEVNAME,netdev=NET-ID,mac=MACADDR,DEV-OPTS...
@@ -336,12 +325,7 @@ The new way is -device DEVNAME,DEV-OPTS...  Details depend on DRIVER:
 * mouse           -device usb-mouse
 * tablet          -device usb-tablet
 * wacom-tablet    -device usb-wacom-tablet
-* host:...        See "Host Device Assignment"
-* disk:...        See "Block Devices"
-* serial:...      See "Character Devices"
 * braille         See "Character Devices"
-* net:...         See "Network Devices"
-* bt:...          not yet available with -device
 
 === Watchdog Devices ===
 
@@ -358,17 +342,11 @@ and host USB devices.  PCI devices can only be assigned with -device:
 
     -device vfio-pci,host=ADDR,id=ID
 
-The old way to assign a host USB device is
-
-    -usbdevice host:auto:BUS.ADDR:VID:PRID
-
-where any of BUS, ADDR, VID, PRID can be the wildcard *.
-
-The new way is
+To assign a host USB device use:
 
     -device usb-host,hostbus=BUS,hostaddr=ADDR,vendorid=VID,productid=PRID
 
-Omitted options match anything, just like the old way's wildcard.
+Omitted options match anything.
 
 === Default Devices ===
 
-- 
2.18.4



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

* [PULL 3/4] ui: fix vc_chr_write call in text_console_do_init
  2020-07-13 14:10 [PULL 0/4] Fixes 20200713 patches Gerd Hoffmann
  2020-07-13 14:10 ` [PULL 1/4] ossaudio: fix out of bounds write Gerd Hoffmann
  2020-07-13 14:10 ` [PULL 2/4] docs/qdev-device-use: Clean up the sentences related to -usbdevice Gerd Hoffmann
@ 2020-07-13 14:10 ` Gerd Hoffmann
  2020-07-13 14:10 ` [PULL 4/4] usb: fix usb-host build on windows Gerd Hoffmann
  2020-07-13 17:58 ` [PULL 0/4] Fixes 20200713 patches Peter Maydell
  4 siblings, 0 replies; 7+ messages in thread
From: Gerd Hoffmann @ 2020-07-13 14:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Daniel P. Berrangé, Gerd Hoffmann, Eduardo Habkost

In case the string doesn't fit into the buffer snprintf returns the size
it would need, so len can be larger than the buffer.  Fix this by simply
using g_strdup_printf() instead of a static buffer.

Reported-by: Wenxiang Qian <leonwxqian@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200701181801.27935-1-kraxel@redhat.com
---
 ui/console.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ui/console.c b/ui/console.c
index 08f75c9bf624..0579be792f33 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -2184,12 +2184,12 @@ static void text_console_do_init(Chardev *chr, DisplayState *ds)
     text_console_resize(s);
 
     if (chr->label) {
-        char msg[128];
-        int len;
+        char *msg;
 
         s->t_attrib.bgcol = QEMU_COLOR_BLUE;
-        len = snprintf(msg, sizeof(msg), "%s console\r\n", chr->label);
-        vc_chr_write(chr, (uint8_t *)msg, len);
+        msg = g_strdup_printf("%s console\r\n", chr->label);
+        vc_chr_write(chr, (uint8_t *)msg, strlen(msg));
+        g_free(msg);
         s->t_attrib = s->t_attrib_default;
     }
 
-- 
2.18.4



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

* [PULL 4/4] usb: fix usb-host build on windows.
  2020-07-13 14:10 [PULL 0/4] Fixes 20200713 patches Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2020-07-13 14:10 ` [PULL 3/4] ui: fix vc_chr_write call in text_console_do_init Gerd Hoffmann
@ 2020-07-13 14:10 ` Gerd Hoffmann
  2020-07-13 17:58 ` [PULL 0/4] Fixes 20200713 patches Peter Maydell
  4 siblings, 0 replies; 7+ messages in thread
From: Gerd Hoffmann @ 2020-07-13 14:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Daniel P. Berrangé, Gerd Hoffmann, Eduardo Habkost

Seems the new API is not available on windows.
Update #ifdefs accordingly.

Fixes: 9f815e83e983 ("usb: add hostdevice property to usb-host")
Reported-by: Howard Spoelstra <hsp.cat7@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Howard Spoelstra <hsp.cat7@gmail.com>
Message-id: 20200624134510.9381-1-kraxel@redhat.com
---
 hw/usb/host-libusb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index ad7ed8fb0c67..c474551d8456 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -907,7 +907,7 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev, int hostfd)
             goto fail;
         }
     } else {
-#if LIBUSB_API_VERSION >= 0x01000107
+#if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN32)
         trace_usb_host_open_hostfd(hostfd);
 
         rc = libusb_wrap_sys_device(ctx, hostfd, &s->dh);
@@ -1107,7 +1107,7 @@ static void usb_host_realize(USBDevice *udev, Error **errp)
     QTAILQ_INIT(&s->isorings);
     s->hostfd = -1;
 
-#if LIBUSB_API_VERSION >= 0x01000107
+#if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN32)
     if (s->hostdevice) {
         int fd;
         s->needs_autoscan = false;
-- 
2.18.4



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

* Re: [PULL 2/4] docs/qdev-device-use: Clean up the sentences related to -usbdevice
  2020-07-13 14:10 ` [PULL 2/4] docs/qdev-device-use: Clean up the sentences related to -usbdevice Gerd Hoffmann
@ 2020-07-13 14:14   ` Peter Maydell
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2020-07-13 14:14 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Paolo Bonzini, Thomas Huth, Daniel P. Berrangé,
	QEMU Developers, Eduardo Habkost

On Mon, 13 Jul 2020 at 15:12, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> From: Thomas Huth <thuth@redhat.com>
>
> Most of the -usbdevice paramaters have been removed already. Update
> the doc accordingly.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> Message-id: 20200710065520.24784-1-thuth@redhat.com
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  docs/qdev-device-use.txt | 28 +++-------------------------
>  1 file changed, 3 insertions(+), 25 deletions(-)

Side note: ideally we should roll this info into the
proper docs/system manual at some point...

thanks
-- PMM


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

* Re: [PULL 0/4] Fixes 20200713 patches
  2020-07-13 14:10 [PULL 0/4] Fixes 20200713 patches Gerd Hoffmann
                   ` (3 preceding siblings ...)
  2020-07-13 14:10 ` [PULL 4/4] usb: fix usb-host build on windows Gerd Hoffmann
@ 2020-07-13 17:58 ` Peter Maydell
  4 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2020-07-13 17:58 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Paolo Bonzini, Daniel P. Berrangé, QEMU Developers, Eduardo Habkost

On Mon, 13 Jul 2020 at 15:12, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> The following changes since commit 9f526fce49c6ac48114ed04914b5a76e4db75785:
>
>   Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-and-misc-110720-2' into staging (2020-07-12 15:32:05 +0100)
>
> are available in the Git repository at:
>
>   git://git.kraxel.org/qemu tags/fixes-20200713-pull-request
>
> for you to fetch changes up to 631009e775a91018a62e2670b4473e99916f858f:
>
>   usb: fix usb-host build on windows. (2020-07-13 11:46:51 +0200)
>
> ----------------------------------------------------------------
> bugfixes for audio, usb, ui and docs.
>
> ----------------------------------------------------------------
>


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.1
for any user-visible changes.

-- PMM


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

end of thread, other threads:[~2020-07-13 18:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-13 14:10 [PULL 0/4] Fixes 20200713 patches Gerd Hoffmann
2020-07-13 14:10 ` [PULL 1/4] ossaudio: fix out of bounds write Gerd Hoffmann
2020-07-13 14:10 ` [PULL 2/4] docs/qdev-device-use: Clean up the sentences related to -usbdevice Gerd Hoffmann
2020-07-13 14:14   ` Peter Maydell
2020-07-13 14:10 ` [PULL 3/4] ui: fix vc_chr_write call in text_console_do_init Gerd Hoffmann
2020-07-13 14:10 ` [PULL 4/4] usb: fix usb-host build on windows Gerd Hoffmann
2020-07-13 17:58 ` [PULL 0/4] Fixes 20200713 patches Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.