[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/30] qemu-pr-helper: fix crash in mpath_reconstruct_sense
From: |
Paolo Bonzini |
Subject: |
[PULL 10/30] qemu-pr-helper: fix crash in mpath_reconstruct_sense |
Date: |
Wed, 2 Oct 2019 18:51:33 +0200 |
From: Maxim Levitsky <address@hidden>
The 'r' variable was accidently shadowed, and because of this
we were always passing 0 to mpath_generic_sense, instead of original
return value, which triggers an abort()
This is an attempt to fix the
https://bugzilla.redhat.com/show_bug.cgi?id=1720047
although there might be other places in the code
that trigger qemu-pr-helper crash, and this fix might
not be the root cause.
The crash was reproduced by creating an iscsi target on a test machine,
and passing it twice to the guest like that:
-blockdev node-name=idisk0,driver=iscsi,transport=...,target=...
-device
scsi-block,drive=idisk0,bus=scsi0.0,bootindex=-1,scsi-id=1,lun=0,share-rw=on
-device
scsi-block,drive=idisk0,bus=scsi0.0,bootindex=-1,scsi-id=1,lun=1,share-rw=on
Then in the guest, both /dev/sda and /dev/sdb were aggregated by multipath to
/dev/mpatha,
which was passed to a nested guest like that
-object
pr-manager-helper,id=qemu_pr_helper,path=/root/work/vm/testvm/.run/pr_helper.socket
-blockdev
node-name=test,driver=host_device,filename=/dev/mapper/mpatha,pr-manager=qemu_pr_helper
-device scsi-block,drive=test,bus=scsi0.0,bootindex=-1,scsi-id=0,lun=0
The nested guest run:
sg_persist --no-inquiry -v --out --register --param-sark 0x1234 /dev/sda
Strictly speaking this is wrong configuration since qemu is where
the multipath was split, and thus the iscsi target was not aware of
multipath, and thus when libmpathpersist code rightfully tried to register
the PR key on all paths, it failed to do so.
However qemu-pr-helper should not crash in this case.
Signed-off-by: Maxim Levitsky <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
scsi/qemu-pr-helper.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c
index a8a74d1..debb18f 100644
--- a/scsi/qemu-pr-helper.c
+++ b/scsi/qemu-pr-helper.c
@@ -323,10 +323,10 @@ static int mpath_reconstruct_sense(int fd, int r, uint8_t
*sense)
*/
uint8_t cdb[6] = { TEST_UNIT_READY };
int sz = 0;
- int r = do_sgio(fd, cdb, sense, NULL, &sz, SG_DXFER_NONE);
+ int ret = do_sgio(fd, cdb, sense, NULL, &sz, SG_DXFER_NONE);
- if (r != GOOD) {
- return r;
+ if (ret != GOOD) {
+ return ret;
}
scsi_build_sense(sense, mpath_generic_sense(r));
return CHECK_CONDITION;
--
1.8.3.1
- [PULL 00/30] Misc patches for 2010-10-02, Paolo Bonzini, 2019/10/02
- [PULL 02/30] target/i386: handle filtered_features in a new function mark_unavailable_features, Paolo Bonzini, 2019/10/02
- [PULL 01/30] tests/migration: Add a test for auto converge, Paolo Bonzini, 2019/10/02
- [PULL 03/30] target/i386: introduce generic feature dependency mechanism, Paolo Bonzini, 2019/10/02
- [PULL 04/30] target/i386: expand feature words to 64 bits, Paolo Bonzini, 2019/10/02
- [PULL 06/30] vmxcap: correct the name of the variables, Paolo Bonzini, 2019/10/02
- [PULL 08/30] target/i386: work around KVM_GET_MSRS bug for secondary execution controls, Paolo Bonzini, 2019/10/02
- [PULL 05/30] target/i386: add VMX definitions, Paolo Bonzini, 2019/10/02
- [PULL 10/30] qemu-pr-helper: fix crash in mpath_reconstruct_sense,
Paolo Bonzini <=
- [PULL 11/30] replay: don't synchronize memory operations in replay mode, Paolo Bonzini, 2019/10/02
- [PULL 07/30] target/i386: add VMX features, Paolo Bonzini, 2019/10/02
- [PULL 09/30] target/i386/kvm: Silence warning from Valgrind about uninitialized bytes, Paolo Bonzini, 2019/10/02
- [PULL 12/30] Makefile: Remove generated files when doing 'distclean', Paolo Bonzini, 2019/10/02
[PULL 13/30] hw/isa: Introduce a CONFIG_ISA_SUPERIO switch for isa-superio.c, Paolo Bonzini, 2019/10/02
[PULL 14/30] ide: fix leak from qemu_allocate_irqs, Paolo Bonzini, 2019/10/02