public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vhost/scsi: Check LUN structure byte 0 is set to 1, per spec
@ 2014-02-24 22:13 Venkatesh Srinivas
  2014-02-24 22:27 ` Paolo Bonzini
  2014-02-25  0:16 ` Nicholas A. Bellinger
  0 siblings, 2 replies; 3+ messages in thread
From: Venkatesh Srinivas @ 2014-02-24 22:13 UTC (permalink / raw)
  To: linux-scsi; +Cc: linux-kernel, pbonzini, nab

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

Signed-off-by: Venkatesh Srinivas <venkateshs@google.com>
---
  drivers/vhost/scsi.c | 6 ++++++
  1 file changed, 6 insertions(+)

diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 0a025b8..e48d4a6 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -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]);
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] vhost/scsi: Check LUN structure byte 0 is set to 1, per spec
  2014-02-24 22:13 [PATCH] vhost/scsi: Check LUN structure byte 0 is set to 1, per spec Venkatesh Srinivas
@ 2014-02-24 22:27 ` Paolo Bonzini
  2014-02-25  0:16 ` Nicholas A. Bellinger
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2014-02-24 22:27 UTC (permalink / raw)
  To: Venkatesh Srinivas; +Cc: linux-scsi, linux-kernel, nab

> The virtio spec requires byte 0 of the virtio-scsi LUN structure
> to be '1'.
> 
> Signed-off-by: Venkatesh Srinivas <venkateshs@google.com>
> ---
>   drivers/vhost/scsi.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
> index 0a025b8..e48d4a6 100644
> --- a/drivers/vhost/scsi.c
> +++ b/drivers/vhost/scsi.c
> @@ -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]);
> --
> 1.8.5.3
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vhost/scsi: Check LUN structure byte 0 is set to 1, per spec
  2014-02-24 22:13 [PATCH] vhost/scsi: Check LUN structure byte 0 is set to 1, per spec Venkatesh Srinivas
  2014-02-24 22:27 ` Paolo Bonzini
@ 2014-02-25  0:16 ` Nicholas A. Bellinger
  1 sibling, 0 replies; 3+ messages in thread
From: Nicholas A. Bellinger @ 2014-02-25  0:16 UTC (permalink / raw)
  To: Venkatesh Srinivas; +Cc: linux-scsi, linux-kernel, pbonzini, target-devel

Hi Venkatesh,

On Mon, 2014-02-24 at 14:13 -0800, Venkatesh Srinivas wrote:
> The virtio spec requires byte 0 of the virtio-scsi LUN structure
> to be '1'.
> 
> Signed-off-by: Venkatesh Srinivas <venkateshs@google.com>
> ---
>   drivers/vhost/scsi.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
> index 0a025b8..e48d4a6 100644
> --- a/drivers/vhost/scsi.c
> +++ b/drivers/vhost/scsi.c
> @@ -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]);

Applied to target-pending/master, and including in the next v3.14-rc
PULL request.

Thanks!

--nab


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-25  0:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-24 22:13 [PATCH] vhost/scsi: Check LUN structure byte 0 is set to 1, per spec Venkatesh Srinivas
2014-02-24 22:27 ` Paolo Bonzini
2014-02-25  0:16 ` Nicholas A. Bellinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox