Skip to content

Commit

Permalink
vhost/scsi: Check LUN structure byte 0 is set to 1, per spec
Browse files Browse the repository at this point in the history
The virtio spec requires byte 0 of the virtio-scsi LUN structure
to be '1'.

Signed-off-by: Venkatesh Srinivas <venkateshs@google.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
  • Loading branch information
Venkatesh Srinivas authored and Nicholas Bellinger committed Feb 25, 2014
1 parent 6f58c78 commit 7fe412d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/vhost/scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 7fe412d

Please sign in to comment.