SHA256
1
0
forked from pool/qemu
qemu/scsi-generic-check-for-additional-SG_IO-.patch
2022-05-27 12:52:53 +00:00

37 lines
1.3 KiB
Diff

From: Hannes Reinecke <hare@suse.de>
Date: Fri, 25 Mar 2022 18:41:52 +0100
Subject: scsi-generic: check for additional SG_IO status on completion
References: bsc#1178049
SG_IO may return additional status in the 'status', 'driver_status',
and 'host_status' fields. When either of these fields are set the
command has not been executed normally, so we should not continue
processing this command but rather return an error.
scsi_read_complete() already checks for these errors,
scsi_write_complete() does not.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Dario Faggioli <dfaggioli@suse.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 343b51c2c0ab5dc7fb792aeb6458..513b10bed0f4279dc4077a31c66f 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -391,7 +391,10 @@ static void scsi_write_complete(void * opaque, int ret)
aio_context_acquire(blk_get_aio_context(s->conf.blk));
- if (ret || r->req.io_canceled) {
+ if (ret || r->req.io_canceled ||
+ r->io_header.status != SCSI_HOST_OK ||
+ (r->io_header.driver_status & SG_ERR_DRIVER_TIMEOUT) ||
+ r->io_header.status != GOOD) {
scsi_command_complete_noio(r, ret);
goto done;
}