qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 54db38: block: Fix nb_sectors check in bdrv_c


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 54db38: block: Fix nb_sectors check in bdrv_check_byte_req...
Date: Fri, 25 Apr 2014 05:00:07 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 54db38a47978381e23e7f6479c31a97b5d352f7e
      
https://github.com/qemu/qemu/commit/54db38a47978381e23e7f6479c31a97b5d352f7e
  Author: Kevin Wolf <address@hidden>
  Date:   2014-04-22 (Tue, 22 Apr 2014)

  Changed paths:
    M block.c

  Log Message:
  -----------
  block: Fix nb_sectors check in bdrv_check_byte_request()

nb_sectors is signed, check for negative values.

Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Max Reitz <address@hidden>


  Commit: 1dd3a44753f10970ded50950d28353c00bfcaf91
      
https://github.com/qemu/qemu/commit/1dd3a44753f10970ded50950d28353c00bfcaf91
  Author: Kevin Wolf <address@hidden>
  Date:   2014-04-22 (Tue, 22 Apr 2014)

  Changed paths:
    M block.c

  Log Message:
  -----------
  block: Limit size to INT_MAX in bdrv_check_byte_request()

Commit 8f4754ed intended to protect against integer overflow bugs in
block drivers by making sure that a single request that is passed to
drivers is no longer than INT_MAX bytes.

However, meanwhile there are some callers that don't use that code path
any more but call bdrv_check_byte_request() directy, so let's add a
check there as well.

Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Max Reitz <address@hidden>


  Commit: da15ee5134f715adb07e3688a1c6e8b42cb6ac94
      
https://github.com/qemu/qemu/commit/da15ee5134f715adb07e3688a1c6e8b42cb6ac94
  Author: Kevin Wolf <address@hidden>
  Date:   2014-04-22 (Tue, 22 Apr 2014)

  Changed paths:
    M block.c
    M tests/qemu-iotests/084.out

  Log Message:
  -----------
  block: Catch integer overflow in bdrv_rw_co()

Insanely large requests could cause an integer overflow in
bdrv_rw_co() while converting sectors to bytes. This patch catches the
problem and returns an error (if we hadn't overflown the integer here,
bdrv_check_byte_request() would have rejected the request, so we're not
breaking anything that was supposed to work before).

We actually do have a test case that triggers behaviour where we
accidentally let such a request pass, so that it would return success,
but read 0 bytes instead of the requested 4 GB. It fails now like it
should.

If the vdi block driver wants to be able to deal with huge images, it
can't read the whole block bitmap at once into memory like it does
today, but needs to use a metadata cache like qcow2 does.

Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 9ce10c0bdcdd8a36c62e3376fd1de86bc0fb8a2a
      
https://github.com/qemu/qemu/commit/9ce10c0bdcdd8a36c62e3376fd1de86bc0fb8a2a
  Author: Kevin Wolf <address@hidden>
  Date:   2014-04-22 (Tue, 22 Apr 2014)

  Changed paths:
    M block.c

  Log Message:
  -----------
  block: Check bdrv_getlength() return value in bdrv_make_zero()

Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Max Reitz <address@hidden>


  Commit: 4ab9dab5b9be0381e714d3fbe518689a72459011
      
https://github.com/qemu/qemu/commit/4ab9dab5b9be0381e714d3fbe518689a72459011
  Author: Fam Zheng <address@hidden>
  Date:   2014-04-22 (Tue, 22 Apr 2014)

  Changed paths:
    M block/vmdk.c

  Log Message:
  -----------
  vmdk: Fix %d and %lld to PRI* in format strings

Signed-off-by: Fam Zheng <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: b8afb520e479e693c227aa39c2fb7670743e104f
      
https://github.com/qemu/qemu/commit/b8afb520e479e693c227aa39c2fb7670743e104f
  Author: Fam Zheng <address@hidden>
  Date:   2014-04-22 (Tue, 22 Apr 2014)

  Changed paths:
    M block-migration.c
    M block.c
    M block/mirror.c
    M include/block/block.h

  Log Message:
  -----------
  block: Handle error of bdrv_getlength in bdrv_create_dirty_bitmap

bdrv_getlength could fail, check the return value before using it.
Return NULL and set errno if it fails. Callers are updated to handle
the error case.

Signed-off-by: Fam Zheng <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: acd7fdc6d80711371d7a1507a22438d9465da63c
      
https://github.com/qemu/qemu/commit/acd7fdc6d80711371d7a1507a22438d9465da63c
  Author: Maria Kustova <address@hidden>
  Date:   2014-04-22 (Tue, 22 Apr 2014)

  Changed paths:
    M block/curl.c

  Log Message:
  -----------
  curl: Replaced old error handling with error reporting API.

Signed-off-by: Maria Kustova <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 636ea3708c253e9d2ddac6bd7d96854ba95fb7f5
      
https://github.com/qemu/qemu/commit/636ea3708c253e9d2ddac6bd7d96854ba95fb7f5
  Author: Kevin Wolf <address@hidden>
  Date:   2014-04-22 (Tue, 22 Apr 2014)

  Changed paths:
    M block.c

  Log Message:
  -----------
  block: Remove -errno return value from bdrv_assign_node_name

It takes an errp argument. That's enough for error handling.

Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 5ff679b47d151c4f73be297f96606eaefb6cc4c4
      
https://github.com/qemu/qemu/commit/5ff679b47d151c4f73be297f96606eaefb6cc4c4
  Author: Aakriti Gupta <address@hidden>
  Date:   2014-04-22 (Tue, 22 Apr 2014)

  Changed paths:
    M block/qed.c

  Log Message:
  -----------
  convert fprintf() calls to error_setg() in block/qed.c:bdrv_qed_create()

This patch converts fprintf() calls to error_setg() in 
block/qed.c:bdrv_qed_create()
(error_setg() is part of error reporting API in include/qapi/error.h)

Signed-off-by: Aakriti Gupta <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 98522f63f40adaebc412481e1d2e9170160d4539
      
https://github.com/qemu/qemu/commit/98522f63f40adaebc412481e1d2e9170160d4539
  Author: Kevin Wolf <address@hidden>
  Date:   2014-04-22 (Tue, 22 Apr 2014)

  Changed paths:
    M block.c
    M block/iscsi.c
    M block/vvfat.c
    M blockdev.c
    M hw/block/xen_disk.c
    M include/block/block.h
    M qemu-img.c
    M qemu-io.c
    M qemu-nbd.c

  Log Message:
  -----------
  block: Add errp to bdrv_new()

This patch adds an errp parameter to bdrv_new() and updates all its
callers. The next patches will make use of this in order to check for
duplicate IDs. Most of the callers know that their ID is fine, so they
can simply assert that there is no error.

Behaviour doesn't change with this patch yet as bdrv_new() doesn't
actually assign errors to errp.

Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 9ffe333276de8ef463896303fb951f03fd4ffcb4
      
https://github.com/qemu/qemu/commit/9ffe333276de8ef463896303fb951f03fd4ffcb4
  Author: Kevin Wolf <address@hidden>
  Date:   2014-04-22 (Tue, 22 Apr 2014)

  Changed paths:
    M qemu-img.c

  Log Message:
  -----------
  qemu-img: Avoid duplicate block device IDs

qemu-img used to use "image" as ID for all block devices. This means
that e.g. img_convert() ended up with potentially multiple source images
and one target image, all with the same ID. The next patch will catch
this and fail to open the block device.

This patch makes sure that qemu-img uses meaningful unique IDs for the
block devices it uses.

Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: f2d953ec31eeeb3029ca915a55938c538a14efa8
      
https://github.com/qemu/qemu/commit/f2d953ec31eeeb3029ca915a55938c538a14efa8
  Author: Kevin Wolf <address@hidden>
  Date:   2014-04-22 (Tue, 22 Apr 2014)

  Changed paths:
    M block.c
    M blockdev.c
    M tests/qemu-iotests/087
    M tests/qemu-iotests/087.out

  Log Message:
  -----------
  block: Catch duplicate IDs in bdrv_new()

Since commit f298d071, block devices added with blockdev-add don't have
a QemuOpts around in dinfo->opts. Consequently, we can't rely any more
on QemuOpts catching duplicate IDs for block devices.

This patch adds a new check for duplicate IDs to bdrv_new(), and moves
the existing check that the ID isn't already taken for a node-name there
as well.

Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 90d9d30152674677aa7b810cf7debe01dc2780f6
      
https://github.com/qemu/qemu/commit/90d9d30152674677aa7b810cf7debe01dc2780f6
  Author: Kevin Wolf <address@hidden>
  Date:   2014-04-22 (Tue, 22 Apr 2014)

  Changed paths:
    M tests/qemu-iotests/087
    M tests/qemu-iotests/087.out

  Log Message:
  -----------
  qemu-iotests: Check common namespace for id and node-name

A name that is taken by an ID can't be taken by a node-name at the same
time. Check that conflicts are correctly detected.

Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>


  Commit: ac1307abfe63ac93a9289e773116bb0de07c335b
      
https://github.com/qemu/qemu/commit/ac1307abfe63ac93a9289e773116bb0de07c335b
  Author: Fam Zheng <address@hidden>
  Date:   2014-04-22 (Tue, 22 Apr 2014)

  Changed paths:
    M qemu-img.c

  Log Message:
  -----------
  qemu-img: Improve error messages

Previously, when there is a user error in argv parsing, qemu-img prints
help text and exits.

Add an error_exit function to print a helpful error message and a hint
to run 'qemu-img --help' for more information.

As a bonus, "qemu-img <cmd> --help" now has a more reasonable exit code
0.

In the future the help text should be split by sub command, and only
print the information for the specified command.

Signed-off-by: Fam Zheng <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 9b17031ac4efcf7a587f0e4eea82287a5329b6e7
      
https://github.com/qemu/qemu/commit/9b17031ac4efcf7a587f0e4eea82287a5329b6e7
  Author: Fam Zheng <address@hidden>
  Date:   2014-04-22 (Tue, 22 Apr 2014)

  Changed paths:
    M block/vmdk.c

  Log Message:
  -----------
  vmdk: Fix "%x" to PRIx32 in format strings for cid

Signed-off-by: Fam Zheng <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 370e681629da587af7592a7b83ebc7ec4955461e
      
https://github.com/qemu/qemu/commit/370e681629da587af7592a7b83ebc7ec4955461e
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2014-04-23 (Wed, 23 Apr 2014)

  Changed paths:
    M block/cloop.c

  Log Message:
  -----------
  block/cloop: use PRIu32 format specifier for uint32_t

PRIu32 is the format string specifier for uint32_t, let's use it.
Variables ->block_size, ->n_blocks, and i are all uint32_t.

Suggested-by: Max Reitz <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 7931b05987564b07ada5a4467d8e78a786a3e7d4
      
https://github.com/qemu/qemu/commit/7931b05987564b07ada5a4467d8e78a786a3e7d4
  Author: Peter Maydell <address@hidden>
  Date:   2014-04-25 (Fri, 25 Apr 2014)

  Changed paths:
    M block-migration.c
    M block.c
    M block/cloop.c
    M block/curl.c
    M block/iscsi.c
    M block/mirror.c
    M block/qed.c
    M block/vmdk.c
    M block/vvfat.c
    M blockdev.c
    M hw/block/xen_disk.c
    M include/block/block.h
    M qemu-img.c
    M qemu-io.c
    M qemu-nbd.c
    M tests/qemu-iotests/084.out
    M tests/qemu-iotests/087
    M tests/qemu-iotests/087.out

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block patches

# gpg: Signature made Wed 23 Apr 2014 11:02:29 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <address@hidden>"

* remotes/kevin/tags/for-upstream:
  block/cloop: use PRIu32 format specifier for uint32_t
  vmdk: Fix "%x" to PRIx32 in format strings for cid
  qemu-img: Improve error messages
  qemu-iotests: Check common namespace for id and node-name
  block: Catch duplicate IDs in bdrv_new()
  qemu-img: Avoid duplicate block device IDs
  block: Add errp to bdrv_new()
  convert fprintf() calls to error_setg() in block/qed.c:bdrv_qed_create()
  block: Remove -errno return value from bdrv_assign_node_name
  curl: Replaced old error handling with error reporting API.
  block: Handle error of bdrv_getlength in bdrv_create_dirty_bitmap
  vmdk: Fix %d and %lld to PRI* in format strings
  block: Check bdrv_getlength() return value in bdrv_make_zero()
  block: Catch integer overflow in bdrv_rw_co()
  block: Limit size to INT_MAX in bdrv_check_byte_request()
  block: Fix nb_sectors check in bdrv_check_byte_request()

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


Compare: https://github.com/qemu/qemu/compare/0e96643c98eb...7931b0598756

reply via email to

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