[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/41] block/iscsi: avoid data corruption with cache=
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 13/41] block/iscsi: avoid data corruption with cache=writeback |
Date: |
Fri, 27 Jan 2017 14:45:21 +0100 |
From: Peter Lieven <address@hidden>
nb_cls_shrunk in iscsi_allocmap_update can become -1 if the
request starts and ends within the same cluster. This results
in passing -1 to bitmap_set and bitmap_clear and they don't
handle negative values properly. In the end this leads to data
corruption.
Fixes: e1123a3b40a1a9a625a29c8ed4debb7e206ea690
Cc: address@hidden
Signed-off-by: Peter Lieven <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
block/iscsi.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index 6aeeb9e..1860f1b 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -499,14 +499,18 @@ iscsi_allocmap_update(IscsiLun *iscsilun, int64_t
sector_num,
if (allocated) {
bitmap_set(iscsilun->allocmap, cl_num_expanded, nb_cls_expanded);
} else {
- bitmap_clear(iscsilun->allocmap, cl_num_shrunk, nb_cls_shrunk);
+ if (nb_cls_shrunk > 0) {
+ bitmap_clear(iscsilun->allocmap, cl_num_shrunk, nb_cls_shrunk);
+ }
}
if (iscsilun->allocmap_valid == NULL) {
return;
}
if (valid) {
- bitmap_set(iscsilun->allocmap_valid, cl_num_shrunk, nb_cls_shrunk);
+ if (nb_cls_shrunk > 0) {
+ bitmap_set(iscsilun->allocmap_valid, cl_num_shrunk, nb_cls_shrunk);
+ }
} else {
bitmap_clear(iscsilun->allocmap_valid, cl_num_expanded,
nb_cls_expanded);
--
1.8.3.1
- [Qemu-devel] [PULL 03/41] replay: don't use rtc clock on loadvm phase, (continued)
- [Qemu-devel] [PULL 03/41] replay: don't use rtc clock on loadvm phase, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 04/41] savevm: add public save_vmstate function, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 05/41] replay: save/load initial state, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 01/41] icount: update instruction counter on apic patching, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 02/41] replay: improve interrupt handling, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 06/41] replay: exception replay fix, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 07/41] apic: save apic_delivered flag, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 08/41] memory: tune mtree_print_mr() to dump mr type, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 12/41] hw/isa/lpc_ich9: negotiate SMI broadcast on pc-q35-2.9+ machine types, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 11/41] hw/isa/lpc_ich9: add broadcast SMI feature, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 13/41] block/iscsi: avoid data corruption with cache=writeback,
Paolo Bonzini <=
- [Qemu-devel] [PULL 09/41] memory: hmp: add "-f" for "info mtree", Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 10/41] hw/isa/lpc_ich9: add SMI feature negotiation via fw_cfg, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 14/41] Introduce DEVICE_CATEGORY_CPU for CPU devices, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 15/41] hw/scsi: Fix debug message of cdb structure in scsi-generic, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 17/41] block: get max_transfer limit for char (scsi-generic) devices, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 18/41] x86-KVM: Supply TSC and APIC clock rates to guest like VMWare, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 16/41] block: Fix target variable of BLKSECTGET ioctl, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 19/41] pc: Enable vmware-cpuid-freq CPU option for 2.9+ machine types, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 23/41] char: add qemu_chr_fe_add_watch() Returns description, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 20/41] block/iscsi: statically link qemu_iscsi_opts, Paolo Bonzini, 2017/01/27