Skip to content

Commit 15ae3ce

Browse files
franciozzybwhacks
authored andcommitted
scsi: virtio_scsi: don't send sc payload with tmfs
commit 3722e6a upstream. The virtio scsi spec defines struct virtio_scsi_ctrl_tmf as a set of device-readable records and a single device-writable response entry: struct virtio_scsi_ctrl_tmf { // Device-readable part le32 type; le32 subtype; u8 lun[8]; le64 id; // Device-writable part u8 response; } The above should be organised as two descriptor entries (or potentially more if using VIRTIO_F_ANY_LAYOUT), but without any extra data after "le64 id" or after "u8 response". The Linux driver doesn't respect that, with virtscsi_abort() and virtscsi_device_reset() setting cmd->sc before calling virtscsi_tmf(). It results in the original scsi command payload (or writable buffers) added to the tmf. This fixes the problem by leaving cmd->sc zeroed out, which makes virtscsi_kick_cmd() add the tmf to the control vq without any payload. Signed-off-by: Felipe Franciosi <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]> Signed-off-by: Ben Hutchings <[email protected]>
1 parent a707bc5 commit 15ae3ce

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

drivers/scsi/virtio_scsi.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,6 @@ static int virtscsi_device_reset(struct scsi_cmnd *sc)
631631
return FAILED;
632632

633633
memset(cmd, 0, sizeof(*cmd));
634-
cmd->sc = sc;
635634
cmd->req.tmf = (struct virtio_scsi_ctrl_tmf_req){
636635
.type = VIRTIO_SCSI_T_TMF,
637636
.subtype = VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET,
@@ -654,7 +653,6 @@ static int virtscsi_abort(struct scsi_cmnd *sc)
654653
return FAILED;
655654

656655
memset(cmd, 0, sizeof(*cmd));
657-
cmd->sc = sc;
658656
cmd->req.tmf = (struct virtio_scsi_ctrl_tmf_req){
659657
.type = VIRTIO_SCSI_T_TMF,
660658
.subtype = VIRTIO_SCSI_T_TMF_ABORT_TASK,

0 commit comments

Comments
 (0)