qemu/block-io-fix-bdrv_co_do_copy_on_readv.patch
Bruce Rogers a447edb5e5 Accepting request 787000 from home:bfrogers:branches:Virtualization
- Include upstream patches targeted for the next stable release
  (bug fixes only)
  block-io-fix-bdrv_co_do_copy_on_readv.patch
  compat-disable-edid-on-correct-virtio-gp.patch
  target-ppc-Fix-rlwinm-on-ppc64.patch
  vhost-correctly-turn-on-VIRTIO_F_IOMMU_P.patch
- s390x Protected Virtualization support - start and control guest
  in secure mode. (note: binary patch from patch series dropped since
  for s390x we rebuild the patched binary anyways) (bsc#1167075
  jsc#SLE-7407)
  s390-sclp-improve-special-wait-psw-logic.patch
  s390x-Add-missing-vcpu-reset-functions.patch
  s390x-Add-SIDA-memory-ops.patch
  s390x-Add-unpack-facility-feature-to-GA1.patch
  s390x-Beautify-diag308-handling.patch
  s390x-Don-t-do-a-normal-reset-on-the-ini.patch
  s390x-ipl-Consolidate-iplb-validity-chec.patch
  s390x-kvm-Make-kvm_sclp_service_call-voi.patch
  s390x-Move-clear-reset.patch
  s390x-Move-diagnose-308-subcodes-and-rcs.patch
  s390x-Move-initial-reset.patch
  s390x-Move-reset-normal-to-shared-reset-.patch
  s390x-protvirt-Add-migration-blocker.patch
  s390x-protvirt-Disable-address-checks-fo.patch
  s390x-protvirt-Handle-SIGP-store-status-.patch
  s390x-protvirt-Inhibit-balloon-when-swit.patch
  s390x-protvirt-KVM-intercept-changes.patch
  s390x-protvirt-Move-diag-308-data-over-S.patch
  s390x-protvirt-Move-IO-control-structure.patch
  s390x-protvirt-Move-STSI-data-over-SIDAD.patch
  s390x-protvirt-SCLP-interpretation.patch
  s390x-protvirt-Set-guest-IPL-PSW.patch
  s390x-protvirt-Support-unpack-facility.patch
  Sync-pv.patch

OBS-URL: https://build.opensuse.org/request/show/787000
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=538
2020-03-20 22:41:29 +00:00

39 lines
1.6 KiB
Diff

From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Date: Thu, 12 Mar 2020 11:19:49 +0300
Subject: block/io: fix bdrv_co_do_copy_on_readv
Git-commit: 4ab78b19189a81038e744728ed949d09aa477550
Prior to 1143ec5ebf4 it was OK to qemu_iovec_from_buf() from aligned-up
buffer to original qiov, as qemu_iovec_from_buf() will stop at qiov end
anyway.
But after 1143ec5ebf4 we assume that bdrv_co_do_copy_on_readv works on
part of original qiov, defined by qiov_offset and bytes. So we must not
touch qiov behind qiov_offset+bytes bound. Fix it.
Cc: qemu-stable@nongnu.org # v4.2
Fixes: 1143ec5ebf4
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 20200312081949.5350-1-vsementsov@virtuozzo.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
block/io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/io.c b/block/io.c
index d1f1ee9138c7af82352e9277f22b..c2c3aab9ee3d1d4d494ce98a6d8b 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1395,7 +1395,7 @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild *child,
if (!(flags & BDRV_REQ_PREFETCH)) {
qemu_iovec_from_buf(qiov, qiov_offset + progress,
bounce_buffer + skip_bytes,
- pnum - skip_bytes);
+ MIN(pnum - skip_bytes, bytes - progress));
}
} else if (!(flags & BDRV_REQ_PREFETCH)) {
/* Read directly into the destination */