[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 72/77] block: Fix bdrv_aligned_p*v() for qiov_offset != 0
From: |
Michael Roth |
Subject: |
[PATCH 72/77] block: Fix bdrv_aligned_p*v() for qiov_offset != 0 |
Date: |
Thu, 3 Sep 2020 15:59:30 -0500 |
From: Max Reitz <mreitz@redhat.com>
Since these functions take a @qiov_offset, they must always take it into
account when working with @qiov. There are a couple of places where
they do not, but they should.
Fixes: 65cd4424b9df03bb5195351c33e04cbbecc0705c
("block/io: bdrv_aligned_preadv: use and support qiov_offset")
Fixes: 28c4da28695bdbe04b336b2c9c463876cc3aaa6d
("block/io: bdrv_aligned_pwritev: use and support qiov_offset")
Reported-by: Claudio Fontana <cfontana@suse.de>
Reported-by: Bruce Rogers <brogers@suse.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200728120806.265916-2-mreitz@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Tested-by: Claudio Fontana <cfontana@suse.de>
Tested-by: Bruce Rogers <brogers@suse.com>
(cherry picked from commit 134b7dec6ec2d90616d7986afb3b3b7ca7a4c383)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
block/io.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/block/io.c b/block/io.c
index aba67f66b9..496c813dd8 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1501,12 +1501,13 @@ static int coroutine_fn bdrv_aligned_preadv(BdrvChild
*child,
assert(num);
ret = bdrv_driver_preadv(bs, offset + bytes - bytes_remaining,
- num, qiov, bytes - bytes_remaining, 0);
+ num, qiov,
+ qiov_offset + bytes - bytes_remaining, 0);
max_bytes -= num;
} else {
num = bytes_remaining;
- ret = qemu_iovec_memset(qiov, bytes - bytes_remaining, 0,
- bytes_remaining);
+ ret = qemu_iovec_memset(qiov, qiov_offset + bytes -
bytes_remaining,
+ 0, bytes_remaining);
}
if (ret < 0) {
goto out;
@@ -2009,7 +2010,8 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild
*child,
}
ret = bdrv_driver_pwritev(bs, offset + bytes - bytes_remaining,
- num, qiov, bytes - bytes_remaining,
+ num, qiov,
+ qiov_offset + bytes - bytes_remaining,
local_flags);
if (ret < 0) {
break;
--
2.17.1
- [PATCH 65/77] virtio: list legacy-capable devices, (continued)
- [PATCH 65/77] virtio: list legacy-capable devices, Michael Roth, 2020/09/03
- [PATCH 67/77] intel_iommu: Use correct shift for 256 bits qi descriptor, Michael Roth, 2020/09/03
- [PATCH 69/77] libvhost-user: Report descriptor index on panic, Michael Roth, 2020/09/03
- [PATCH 06/77] nbd/server: Avoid long error message assertions CVE-2020-10761, Michael Roth, 2020/09/03
- [PATCH 71/77] migration/block-dirty-bitmap: fix dirty_bitmap_mig_before_vm_start, Michael Roth, 2020/09/03
- [PATCH 64/77] virtio-balloon: Replace free page hinting references to 'report' with 'hint', Michael Roth, 2020/09/03
- [PATCH 66/77] virtio: verify that legacy support is not accidentally on, Michael Roth, 2020/09/03
- [PATCH 68/77] virtio-pci: Changed vdev to proxy for VirtIO PCI BAR callbacks., Michael Roth, 2020/09/03
- [PATCH 62/77] virtio-balloon: always indicate S_DONE when migration fails, Michael Roth, 2020/09/03
- [PATCH 72/77] block: Fix bdrv_aligned_p*v() for qiov_offset != 0,
Michael Roth <=
- [PATCH 73/77] iotests/028: Add test for cross-base-EOF reads, Michael Roth, 2020/09/03
- [PATCH 74/77] nbd: Fix large trim/zero requests, Michael Roth, 2020/09/03
- [PATCH 70/77] Update OpenBIOS images to 7f28286f built from submodule., Michael Roth, 2020/09/03
- [PATCH 75/77] virtio-net: align RSC fields with updated virtio-net header, Michael Roth, 2020/09/03
- [PATCH 76/77] hw/arm/sbsa-ref: fix typo breaking PCIe IRQs, Michael Roth, 2020/09/03
- [PATCH 77/77] usb: fix setup_len init (CVE-2020-14364), Michael Roth, 2020/09/03
- [PATCH 07/77] virtio-balloon: fix free page hinting without an iothread, Michael Roth, 2020/09/03
- [PATCH 08/77] virtio-balloon: fix free page hinting check on unrealize, Michael Roth, 2020/09/03
- Re: [PATCH 00/77] Patch Round-up for stable 5.0.1, freeze on 2020-09-10, Philippe Mathieu-Daudé, 2020/09/04