qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] f4bbaa: usb: Propagate errors through usb_reg


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] f4bbaa: usb: Propagate errors through usb_register_compani...
Date: Fri, 20 Mar 2015 04:00:06 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: f4bbaaf584ed8d0a430b467bace15f338cba4c57
      
https://github.com/qemu/qemu/commit/f4bbaaf584ed8d0a430b467bace15f338cba4c57
  Author: Markus Armbruster <address@hidden>
  Date:   2015-03-17 (Tue, 17 Mar 2015)

  Changed paths:
    M hw/usb/bus.c
    M hw/usb/hcd-ehci.c
    M hw/usb/hcd-ohci.c
    M hw/usb/hcd-uhci.c
    M include/hw/usb.h

  Log Message:
  -----------
  usb: Propagate errors through usb_register_companion()

This loses the messages explaining the error printed with
error_printf_unless_qmp().  The next commit will make up for the loss.

Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 2e269f3d9d806987977b3c76deb26647f2bf33e1
      
https://github.com/qemu/qemu/commit/2e269f3d9d806987977b3c76deb26647f2bf33e1
  Author: Markus Armbruster <address@hidden>
  Date:   2015-03-17 (Tue, 17 Mar 2015)

  Changed paths:
    M hw/usb/bus.c
    M hw/usb/hcd-ehci.c

  Log Message:
  -----------
  usb: Improve companion configuration error messages

The previous commit broke the additional messages explaining the error
messages.  Improve the error messages, so they don't need explaining
so much.  Helps QMP users as well, unlike additional explanations.

Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 87581feaa112733e8d999ade8a4d08816e908268
      
https://github.com/qemu/qemu/commit/87581feaa112733e8d999ade8a4d08816e908268
  Author: Markus Armbruster <address@hidden>
  Date:   2015-03-17 (Tue, 17 Mar 2015)

  Changed paths:
    M hw/usb/hcd-ohci.c

  Log Message:
  -----------
  ohci: Complete conversion to realize

Commit 457215ec "ohci: Use QOM realize for OHCI" converted only
"sysbus-ohci".  Finish the job: convert "pci-ohci".

Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 63216dc78d2d52448afdfbe0e0bacb2c669083b4
      
https://github.com/qemu/qemu/commit/63216dc78d2d52448afdfbe0e0bacb2c669083b4
  Author: Markus Armbruster <address@hidden>
  Date:   2015-03-17 (Tue, 17 Mar 2015)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: Convert to realize

Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: bcf5d19c59a527c91bc29704f3e4956119c050cf
      
https://github.com/qemu/qemu/commit/bcf5d19c59a527c91bc29704f3e4956119c050cf
  Author: Markus Armbruster <address@hidden>
  Date:   2015-03-17 (Tue, 17 Mar 2015)

  Changed paths:
    M monitor.c

  Log Message:
  -----------
  monitor: Drop dead QMP check from monitor_read_password()

Function is only called in HMP context since commit 333a96e "qapi:
Convert change".

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 988e0f06621fde11ec0d319a6fd0ab3ccef0602f
      
https://github.com/qemu/qemu/commit/988e0f06621fde11ec0d319a6fd0ab3ccef0602f
  Author: Markus Armbruster <address@hidden>
  Date:   2015-03-17 (Tue, 17 Mar 2015)

  Changed paths:
    M monitor.c

  Log Message:
  -----------
  monitor: Plug memory leak in monitor_read_bdrv_key_start()

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 9b14e0efcc9a6ea41b7265538f6ec4c53e2ba270
      
https://github.com/qemu/qemu/commit/9b14e0efcc9a6ea41b7265538f6ec4c53e2ba270
  Author: Markus Armbruster <address@hidden>
  Date:   2015-03-17 (Tue, 17 Mar 2015)

  Changed paths:
    M hw/usb/dev-storage.c
    M monitor.c

  Log Message:
  -----------
  monitor usb: Inline monitor_read_bdrv_key_start()'s first part

monitor_read_bdrv_key_start() does several things:

1. If no key is needed, call completion_cb() and succeed

2. If we're in QMP context, call qerror_report_err() and fail

3. Start reading the key in the monitor.

This is two things too many.  Inline 1. and 2. into its callers
monitor_read_block_device_key() and usb_msd_realize_storage().

Since monitor_read_block_device_key() only ever runs in HMP context,
drop 2. there.

The next commit will clean up the result in usb_msd_realize_storage().

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 7afcc1f9bae3e857834a3bb8247be101e2354998
      
https://github.com/qemu/qemu/commit/7afcc1f9bae3e857834a3bb8247be101e2354998
  Author: Markus Armbruster <address@hidden>
  Date:   2015-03-17 (Tue, 17 Mar 2015)

  Changed paths:
    M hw/usb/dev-storage.c

  Log Message:
  -----------
  usb/dev-storage: Fix QMP device_add missing encryption key failure

When the image is encrypted, QMP device_add creates the device, defers
actually attaching it to when the key becomes available, then returns
an error.  This is wrong.  device_add must either create the device
and succeed, or do nothing and fail.

The bug is in usb_msd_realize_storage().  It posts an error with
qerror_report_err(), and returns success.  Device realization relies
on the return value, and completes.  The QMP monitor, however, relies
on the posted error, and sends it in an error reply.

Reproducer:

    $ qemu-system-x86_64 -nodefaults -display none -usb -qmp stdio -drive 
if=none,id=foo,file=geheim.qcow2
    {"QMP": {"version": {"qemu": {"micro": 50, "minor": 2, "major": 2}, 
"package": ""}, "capabilities": []}}
    { "execute": "qmp_capabilities" }
    {"return": {}}
    { "execute": "device_add", "arguments": { "driver": "usb-storage", "id": 
"bar", "drive": "foo" } }
    {"error": {"class": "DeviceEncrypted", "desc": "'foo' (geheim.qcow2) is 
encrypted"}}

Even though we got an error back, the device got created just fine.
To demonstrate, let's unplug it again:

    {"execute":"device_del","arguments": { "id": "bar" } }
    {"timestamp": {"seconds": 1426003440, "microseconds": 237181}, "event": 
"DEVICE_DELETED", "data": {"path": "/machine/peripheral/bar/bar.0/legacy[0]"}}
    {"timestamp": {"seconds": 1426003440, "microseconds": 238231}, "event": 
"DEVICE_DELETED", "data": {"device": "bar", "path": "/machine/peripheral/bar"}}
    {"return": {}}

Fix by making usb_msd_realize_storage() fail properly.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: c326529b74aa37adb216604bb6ca93cd49007012
      
https://github.com/qemu/qemu/commit/c326529b74aa37adb216604bb6ca93cd49007012
  Author: Markus Armbruster <address@hidden>
  Date:   2015-03-17 (Tue, 17 Mar 2015)

  Changed paths:
    M hw/usb/dev-storage.c

  Log Message:
  -----------
  usb/dev-storage: Avoid qerror_report_err() outside QMP handlers

qerror_report_err() is a transitional interface to help with
converting existing monitor commands to QMP.  It should not be used
elsewhere.

usb_msd_password_cb() is only called from within an HMP command
handler.  Replace by error_report_err().

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 8ffd9f4dd41f0423f0df8bef8f2e25ab4bb1a3f3
      
https://github.com/qemu/qemu/commit/8ffd9f4dd41f0423f0df8bef8f2e25ab4bb1a3f3
  Author: Thomas Huth <address@hidden>
  Date:   2015-03-18 (Wed, 18 Mar 2015)

  Changed paths:
    M default-configs/arm-softmmu.mak
    M default-configs/usb.mak
    M hw/usb/Makefile.objs

  Log Message:
  -----------
  hw/usb: Include USB files only if necessary

Boards that do not include an USB controller should not provide
USB devices. However, when running "qemu-system-s390x -device help"
for example, there's still a usb-hub, usb-kbd, usb-mouse and
usb-tablet in the list of "supported" devices. Let's fix that
by compiling and linking the USB files only if it is really
necessary.

Signed-off-by: Thomas Huth <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 537e572a7f807d7371a73ea5ffd9ce8d2487ff0c
      
https://github.com/qemu/qemu/commit/537e572a7f807d7371a73ea5ffd9ce8d2487ff0c
  Author: Gonglei <address@hidden>
  Date:   2015-03-20 (Fri, 20 Mar 2015)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: fix segfault when hot-unplugging uhci controller

When hot-unplugging the usb controllers (ehci/uhci),
we have to clean all resouce of these devices,
involved registered reset handler. Otherwise, it
may cause NULL pointer access and/or segmentation fault
if we reboot the guest os after hot-unplugging.

Let's hook up reset via DeviceClass->reset() and drop
the qemu_register_reset() call. Then Qemu will register
and unregister the reset handler automatically.

Cc: qemu-stable <address@hidden>
Reported-by: Lidonglin <address@hidden>
Signed-off-by: Gonglei <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 88dd1b8d0063ff16c54dc19c8b52508a00108f50
      
https://github.com/qemu/qemu/commit/88dd1b8d0063ff16c54dc19c8b52508a00108f50
  Author: Gonglei <address@hidden>
  Date:   2015-03-20 (Fri, 20 Mar 2015)

  Changed paths:
    M hw/usb/hcd-ohci.c

  Log Message:
  -----------
  ohci: fix resource cleanup leak

When hot-unplugging the usb controllers (ehci/uhci),
we have to clean all resouce of these devices,
involved registered reset handler. Otherwise, it
may cause NULL pointer access and/or segmentation fault
if we reboot the guest os after hot-unplugging.

Let's hook up reset via DeviceClass->reset() and drop
the qemu_register_reset() call. Then Qemu will register
and unregister the reset handler automatically.

Ohci does't support hotplugging/hotunplugging yet, but
existing resource cleanup leak logic likes ehci/uhci.

Cc: qemu-stable <address@hidden>
Signed-off-by: Gonglei <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 4e289b1b62c8e271e3400317b4c3d98909093bc4
      
https://github.com/qemu/qemu/commit/4e289b1b62c8e271e3400317b4c3d98909093bc4
  Author: Gonglei <address@hidden>
  Date:   2015-03-20 (Fri, 20 Mar 2015)

  Changed paths:
    M hw/usb/hcd-ehci-pci.c
    M hw/usb/hcd-ehci-sysbus.c
    M hw/usb/hcd-ehci.c
    M hw/usb/hcd-ehci.h

  Log Message:
  -----------
  ehci: fix segfault when hot-unplugging ehci controller

When hot-unplugging the usb controllers (ehci/uhci),
we have to clean all resouce of these devices,
involved registered reset handler. Otherwise, it
may cause NULL pointer access and/or segmentation fault
if we reboot the guest os after hot-unplugging.

Let's hook up reset via DeviceClass->reset() and drop
the qemu_register_reset() call. Then Qemu will register
and unregister the reset handler automatically.

Cc: qemu-stable <address@hidden>
Reported-by: Lidonglin <address@hidden>
Signed-off-by: Gonglei <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: e7e9b49f8e9ea4c5c9d07f6d8c9071c64dae816a
      
https://github.com/qemu/qemu/commit/e7e9b49f8e9ea4c5c9d07f6d8c9071c64dae816a
  Author: Peter Maydell <address@hidden>
  Date:   2015-03-20 (Fri, 20 Mar 2015)

  Changed paths:
    M default-configs/arm-softmmu.mak
    M default-configs/usb.mak
    M hw/usb/Makefile.objs
    M hw/usb/bus.c
    M hw/usb/dev-storage.c
    M hw/usb/hcd-ehci-pci.c
    M hw/usb/hcd-ehci-sysbus.c
    M hw/usb/hcd-ehci.c
    M hw/usb/hcd-ehci.h
    M hw/usb/hcd-ohci.c
    M hw/usb/hcd-uhci.c
    M include/hw/usb.h
    M monitor.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20150320-1' into 
staging

usb: bugfix collection.

# gpg: Signature made Fri Mar 20 07:51:19 2015 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <address@hidden>"
# gpg:                 aka "Gerd Hoffmann <address@hidden>"
# gpg:                 aka "Gerd Hoffmann (private) <address@hidden>"

* remotes/kraxel/tags/pull-usb-20150320-1:
  ehci: fix segfault when hot-unplugging ehci controller
  ohci: fix resource cleanup leak
  uhci: fix segfault when hot-unplugging uhci controller
  hw/usb: Include USB files only if necessary
  usb/dev-storage: Avoid qerror_report_err() outside QMP handlers
  usb/dev-storage: Fix QMP device_add missing encryption key failure
  monitor usb: Inline monitor_read_bdrv_key_start()'s first part
  monitor: Plug memory leak in monitor_read_bdrv_key_start()
  monitor: Drop dead QMP check from monitor_read_password()
  uhci: Convert to realize
  ohci: Complete conversion to realize
  usb: Improve companion configuration error messages
  usb: Propagate errors through usb_register_companion()

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/3e5f6234b4f4...e7e9b49f8e9e

reply via email to

[Prev in Thread] Current Thread [Next in Thread]