[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/4] scsi-generic: do not do VPD emulation for sense
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 4/4] scsi-generic: do not do VPD emulation for sense other than ILLEGAL_REQUEST |
Date: |
Mon, 29 Oct 2018 18:34:37 +0100 |
Pass other sense, such as UNIT_ATTENTION or BUSY, directly to the
guest.
Reported-by: Max Reitz <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/scsi/scsi-generic.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 8fc74ef0bd..b8fa0a0f7e 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -246,7 +246,6 @@ static void scsi_read_complete(void * opaque, int ret)
{
SCSIGenericReq *r = (SCSIGenericReq *)opaque;
SCSIDevice *s = r->req.dev;
- SCSISense sense;
int len;
assert(r->req.aiocb != NULL);
@@ -269,12 +268,15 @@ static void scsi_read_complete(void * opaque, int ret)
* resulted in sense error but would need emulation.
* In this case, emulate a valid VPD response.
*/
- if (s->needs_vpd_bl_emulation) {
+ if (ret == 0 &&
+ (r->io_header.driver_status & SG_ERR_DRIVER_SENSE) &&
+ scsi_parse_sense_buf(r->req.sense, r->io_header.sb_len_wr).key ==
ILLEGAL_REQUEST &&
+ s->needs_vpd_bl_emulation) {
int is_vpd_bl = r->req.cmd.buf[0] == INQUIRY &&
r->req.cmd.buf[1] & 0x01 &&
r->req.cmd.buf[2] == 0xb0;
- if (is_vpd_bl && sg_io_sense_from_errno(-ret, &r->io_header, &sense)) {
+ if (is_vpd_bl) {
len = scsi_generic_emulate_block_limits(r, s);
/*
* No need to let scsi_read_complete go on and handle an
--
2.17.1
- [Qemu-devel] [PATCH 0/4] scsi-generic: fixes for Block Limits emulation, Paolo Bonzini, 2018/10/29
- [Qemu-devel] [PATCH 1/4] scsi-generic: keep VPD page list sorted, Paolo Bonzini, 2018/10/29
- [Qemu-devel] [PATCH 2/4] scsi-generic: avoid out-of-bounds access to VPD page list, Paolo Bonzini, 2018/10/29
- [Qemu-devel] [PATCH 4/4] scsi-generic: do not do VPD emulation for sense other than ILLEGAL_REQUEST,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 3/4] scsi-generic: avoid invalid access to struct when emulating block limits, Paolo Bonzini, 2018/10/29
- Re: [Qemu-devel] [PATCH 0/4] scsi-generic: fixes for Block Limits emulation, no-reply, 2018/10/31
- Re: [Qemu-devel] [PATCH 0/4] scsi-generic: fixes for Block Limits emulation, no-reply, 2018/10/31