mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
UPSTREAM: scsi: virtio_scsi: Do not overwrite SCSI status
When a sense code is present we should not override the SAM status; the driver already sets it based on the response from the hypervisor. In addition we should only copy the sense buffer if one is actually provided by the hypervisor. Link: https://lore.kernel.org/r/20210622091153.29231-1-hare@suse.de Fixes:464a00c9e0("scsi: core: Kill DRIVER_SENSE") Tested-by: Guenter Roeck <linux@roeck-us.net> Tested-by: Jiri Slaby <jirislaby@kernel.org> Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> (cherry picked from commitc43ddbf97f) Bug: 187129171 Signed-off-by: Connor O'Brien <connoro@google.com> Change-Id: I6a42c80e2cbd6786f2e08ebe4226f2cddfbb8e97
This commit is contained in:
committed by
Connor O'Brien
parent
973230a4ca
commit
d5f74773bf
@@ -156,13 +156,11 @@ static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf)
|
||||
|
||||
WARN_ON(virtio32_to_cpu(vscsi->vdev, resp->sense_len) >
|
||||
VIRTIO_SCSI_SENSE_SIZE);
|
||||
if (sc->sense_buffer) {
|
||||
if (resp->sense_len) {
|
||||
memcpy(sc->sense_buffer, resp->sense,
|
||||
min_t(u32,
|
||||
virtio32_to_cpu(vscsi->vdev, resp->sense_len),
|
||||
VIRTIO_SCSI_SENSE_SIZE));
|
||||
if (resp->sense_len)
|
||||
set_driver_byte(sc, DRIVER_SENSE);
|
||||
}
|
||||
|
||||
sc->scsi_done(sc);
|
||||
|
||||
Reference in New Issue
Block a user