Skip to contentSkip to conversation

vhost/scsi: fix up req type endian-ness

PATCH In review Michael S. Tsirkin 4 participants 4 messages Jul 10, 2020 – Jul 16, 2020

Subsystems (7)
lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

PATCH 1/1 vhost/scsi: fix up req type endian-ness

vhost/scsi doesn't handle type conversion correctly for request type when using virtio 1.0 and up for BE, or cross-endian platforms.

Fix it up using vhost_32_to_cpu.

---
 drivers/vhost/scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/scsi.c +1 -1
index 6fb4d7ecfa19..b22adf03f584 100644
@@ -1215,7 +1215,7 @@ vhost_scsi_ctl_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
 			continue;
 		}
 
-		switch (v_req.type) {
+		switch (vhost32_to_cpu(vq, v_req.type)) {
 		case VIRTIO_SCSI_T_TMF:
 			vc.req = &v_req.tmf;
 			vc.req_size = sizeof(struct virtio_scsi_ctrl_tmf_req);
Signature · 1 line
MST
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Michael S. Tsirkin

vhost/scsi doesn't handle type conversion correctly for request type when using virtio 1.0 and up for BE, or cross-endian platforms.

Fix it up using vhost_32_to_cpu.

---
  drivers/vhost/scsi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/scsi.c +0 -0
index 6fb4d7ecfa19..b22adf03f584 100644

drivers/vhost/scsi.c vhost_scsi_ctl_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) · line 1221

Quoted 8 lines
drivers/vhost/scsi.c +1 -1
@@ -1215,7 +1215,7 @@ vhost_scsi_ctl_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
  			continue;
  		}
 
-		switch (v_req.type) {
+		switch (vhost32_to_cpu(vq, v_req.type)) {
  		case VIRTIO_SCSI_T_TMF:
  			vc.req = &v_req.tmf;
  			vc.req_size = sizeof(struct virtio_scsi_ctrl_tmf_req);
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Michael S. Tsirkin
Quoted 11 lines · Michael S. Tsirkin

vhost/scsi doesn't handle type conversion correctly for request type when using virtio 1.0 and up for BE, or cross-endian platforms.

Fix it up using vhost_32_to_cpu.

---
 drivers/vhost/scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
maintainer
#3 lore raw
In reply to Michael S. Tsirkin

Hi

[This is an automated email]

This commit has been processed because it contains a -stable tag. The stable tag indicates that it's relevant for the following trees: all

The bot has tested the following trees: v5.7.8, v5.4.51, v4.19.132, v4.14.188, v4.9.230, v4.4.230.

v5.7.8: Build OK!
v5.4.51: Build OK!
v4.19.132: Failed to apply! Possible dependencies:
0d02dbd68c47b ("vhost/scsi: Respond to control queue operations")

v4.14.188: Failed to apply! Possible dependencies:
0d02dbd68c47b ("vhost/scsi: Respond to control queue operations")

v4.9.230: Failed to apply! Possible dependencies:
0d02dbd68c47b ("vhost/scsi: Respond to control queue operations")

v4.4.230: Failed to apply! Possible dependencies:
0d02dbd68c47b ("vhost/scsi: Respond to control queue operations")

NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

Signature · 2 lines
Thanks
Sasha