]> git.proxmox.com Git - pve-qemu.git/blame - debian/patches/pve/0046-block-io-accept-NULL-qiov-in-bdrv_pad_request.patch
udpate and rebase to QEMU v6.0.0
[pve-qemu.git] / debian / patches / pve / 0046-block-io-accept-NULL-qiov-in-bdrv_pad_request.patch
CommitLineData
677d0d16
SR
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Stefan Reiter <s.reiter@proxmox.com>
3Date: Tue, 2 Mar 2021 16:11:54 +0100
4Subject: [PATCH] block/io: accept NULL qiov in bdrv_pad_request
5
6Some operations, e.g. block-stream, perform reads while discarding the
7results (only copy-on-read matters). In this case they will pass NULL as
8the target QEMUIOVector, which will however trip bdrv_pad_request, since
9it wants to extend its passed vector.
10
11Simply check for NULL and do nothing, there's no reason to pad the
12target if it will be discarded anyway.
13---
8dca018b
SR
14 block/io.c | 4 ++++
15 1 file changed, 4 insertions(+)
677d0d16
SR
16
17diff --git a/block/io.c b/block/io.c
8dca018b 18index ca2dca3007..a9e70a4f91 100644
677d0d16
SR
19--- a/block/io.c
20+++ b/block/io.c
8dca018b
SR
21@@ -1731,6 +1731,10 @@ static int bdrv_pad_request(BlockDriverState *bs,
22 {
23 int ret;
677d0d16 24
8dca018b
SR
25+ if (!qiov) {
26+ return 0;
677d0d16
SR
27+ }
28+
8dca018b 29 bdrv_check_qiov_request(*offset, *bytes, *qiov, *qiov_offset, &error_abort);
677d0d16 30
8dca018b 31 if (!bdrv_init_padding(bs, *offset, *bytes, pad)) {