usb: bugfix collection.

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJVC9F3AAoJEEy22O7T6HE4kJYQAIb5UZgIso2tKJe2QtUdWk+a
 aliDfUeYjbILgyOuB+wYQ+hGuSQgbArP+RT4G1cpv6wJKKOqNmJI83ahD4GMNvZS
 ZC7Z9lx7RjNW7lCTA0+H8Zd1YtEJKb4aleFYVCfL6u+8Yx/JK+W0nToMpZcw+H3O
 xlGclKNkyd4M5sE9XJXn/SPDDfqQ15Clor1yWBAqyHuzWFkyo/WhxwKidXZE6RjZ
 PSS0sDTwTHLz4wvjUrPt8N4JR1l226g0M32HjyNRRcqQEmCHZb/QM/BNBOOBX7aF
 3sAAxpmUro+bA3mljVV34RedTWpv5FQ/d8Ye0t2eWjQfzksDjcJhYU0pfNSUYdvG
 2SnBL3e05Ykl+nvsvWbgcobMHiTvZqiBMyV4LXJKvRIwMJRfhWgKKLpQLFM2ZYyX
 bcfC6OBthluY7eqJWIkDUsIevjxSYkSz0cvbFXVZk/+jCb5Q2/SgW+3No0NxuwpF
 lx1VYqJ4UCg7om91TOqT30CYIHfFpNPhWyk2j9/kSCnod/pTZQ7Q3J3ePf1Kts+Z
 K1G/9nh86pHhb/jrGVxqotPt1j+xG7Dd7J10BDkAa0ylIkMbsV1JS8D+1v5d5QZA
 I6odLJJunhtxbMzFP2yE/gZLaMQoUA5PgNRBqwGfam4o5MxdmXWojnahWXwbqecl
 nbK4Tmae1cFoWytDZikP
 =T+GC
 -----END PGP SIGNATURE-----

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) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* 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 <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2015-03-20 09:50:08 +00:00
commit e7e9b49f8e
13 changed files with 152 additions and 111 deletions

View file

@ -266,10 +266,7 @@ void monitor_read_command(Monitor *mon, int show_prompt)
int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,
void *opaque)
{
if (monitor_ctrl_mode(mon)) {
qerror_report(QERR_MISSING_PARAMETER, "password");
return -EINVAL;
} else if (mon->rs) {
if (mon->rs) {
readline_start(mon->rs, "Password: ", 1, readline_func, opaque);
/* prompt is printed on return from the command handler */
return 0;
@ -5389,23 +5386,8 @@ int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs,
BlockCompletionFunc *completion_cb,
void *opaque)
{
Error *local_err = NULL;
int err;
bdrv_add_key(bs, NULL, &local_err);
if (!local_err) {
if (completion_cb)
completion_cb(opaque, 0);
return 0;
}
/* Need a key for @bs */
if (monitor_ctrl_mode(mon)) {
qerror_report_err(local_err);
return -1;
}
monitor_printf(mon, "%s (%s) is encrypted.\n", bdrv_get_device_name(bs),
bdrv_get_encrypted_filename(bs));
@ -5424,6 +5406,7 @@ int monitor_read_block_device_key(Monitor *mon, const char *device,
BlockCompletionFunc *completion_cb,
void *opaque)
{
Error *err = NULL;
BlockBackend *blk;
blk = blk_by_name(device);
@ -5432,7 +5415,16 @@ int monitor_read_block_device_key(Monitor *mon, const char *device,
return -1;
}
return monitor_read_bdrv_key_start(mon, blk_bs(blk), completion_cb, opaque);
bdrv_add_key(blk_bs(blk), NULL, &err);
if (err) {
error_free(err);
return monitor_read_bdrv_key_start(mon, blk_bs(blk), completion_cb, opaque);
}
if (completion_cb) {
completion_cb(opaque, 0);
}
return 0;
}
QemuOptsList qemu_mon_opts = {