Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7fe412d0 authored by Venkatesh Srinivas's avatar Venkatesh Srinivas Committed by Nicholas Bellinger
Browse files

vhost/scsi: Check LUN structure byte 0 is set to 1, per spec



The virtio spec requires byte 0 of the virtio-scsi LUN structure
to be '1'.

Signed-off-by: default avatarVenkatesh Srinivas <venkateshs@google.com>
Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 6f58c780
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1001,6 +1001,12 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
			break;
		}

		/* virtio-scsi spec requires byte 0 of the lun to be 1 */
		if (unlikely(v_req.lun[0] != 1)) {
			vhost_scsi_send_bad_target(vs, vq, head, out);
			continue;
		}

		/* Extract the tpgt */
		target = v_req.lun[1];
		tpg = ACCESS_ONCE(vs_tpg[target]);