[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/23] scsi-generic: do not snoop the output of failed commands
From: |
Paolo Bonzini |
Subject: |
[PULL 15/23] scsi-generic: do not snoop the output of failed commands |
Date: |
Sat, 6 Mar 2021 11:54:11 +0100 |
If a READ CAPACITY command would fail, for example s->qdev.blocksize would be
set to zero and cause a division by zero on the next use.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/scsi/scsi-generic.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index cf7e11cf44..f9fd2ccfdd 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -288,7 +288,10 @@ static void scsi_read_complete(void * opaque, int ret)
}
}
- if (len == 0) {
+ if (r->io_header.host_status != SCSI_HOST_OK ||
+ (r->io_header.driver_status & SG_ERR_DRIVER_TIMEOUT) ||
+ r->io_header.status != GOOD ||
+ len == 0) {
scsi_command_complete_noio(r, 0);
goto done;
}
--
2.29.2
- [PULL 02/23] KVM: x86: deprecate -M kernel-irqchip=off except for -M isapc, (continued)
- [PULL 02/23] KVM: x86: deprecate -M kernel-irqchip=off except for -M isapc, Paolo Bonzini, 2021/03/06
- [PULL 03/23] qga-vss: Use dynamic linking for GLib, Paolo Bonzini, 2021/03/06
- [PULL 04/23] chardev: add nodelay option, Paolo Bonzini, 2021/03/06
- [PULL 05/23] qom: Check for wellformed id in user_creatable_add_type(), Paolo Bonzini, 2021/03/06
- [PULL 06/23] vl.c: do not execute trace_init_backends() before daemonizing, Paolo Bonzini, 2021/03/06
- [PULL 07/23] accel: kvm: Fix memory waste under mismatch page size, Paolo Bonzini, 2021/03/06
- [PULL 10/23] elf_ops: correct loading of 32 bit PVH kernel, Paolo Bonzini, 2021/03/06
- [PULL 11/23] x86/pvh: extract only 4 bytes of start address for 32 bit kernels, Paolo Bonzini, 2021/03/06
- [PULL 13/23] scsi: Rename linux-specific SG_ERR codes to generic SCSI_HOST error codes, Paolo Bonzini, 2021/03/06
- [PULL 12/23] qemu-config: add error propagation to qemu_config_parse, Paolo Bonzini, 2021/03/06
- [PULL 15/23] scsi-generic: do not snoop the output of failed commands,
Paolo Bonzini <=
- [PULL 16/23] scsi: inline sg_io_sense_from_errno() into the callers., Paolo Bonzini, 2021/03/06
- [PULL 20/23] meson: adjust timeouts for some slower tests, Paolo Bonzini, 2021/03/06
- [PULL 21/23] trace: fix "-trace file=...", Paolo Bonzini, 2021/03/06
- [PULL 22/23] trace: skip qemu_set_log_filename if no "-D" option was passed, Paolo Bonzini, 2021/03/06
- [PULL 08/23] accel: kvm: Add aligment assert for kvm_log_clear_one_slot, Paolo Bonzini, 2021/03/06
- [PULL 14/23] scsi: Add mapping for generic SCSI_HOST status to sense codes, Paolo Bonzini, 2021/03/06
- [PULL 17/23] scsi: move host_status handling into SCSI drivers, Paolo Bonzini, 2021/03/06
- [PULL 18/23] qemu-option: do not suggest using the delay option, Paolo Bonzini, 2021/03/06
- [PULL 19/23] build-sys: invoke ninja with -d keepdepfile, Paolo Bonzini, 2021/03/06
- [PULL 23/23] meson: Stop if cfi is enabled with system slirp, Paolo Bonzini, 2021/03/06