On Wed, 2012-04-18 at 15:06 +0800, zwu.kernel@xxxxxxxxx wrote:
> From: Zhi Yong Wu <wuzhy@xxxxxxxxxxxxxxxxxx>
>
> Signed-off-by: Zhi Yong Wu <wuzhy@xxxxxxxxxxxxxxxxxx>
> ---
> drivers/target/tcm_vhost/tcm_vhost_scsi.c | 36 +++++++++-------------------
> 1 files changed, 12 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/target/tcm_vhost/tcm_vhost_scsi.c b/drivers/target/tcm_vhost/tcm_vhost_scsi.c
> index cd8ff54..8b56d59 100644
> --- a/drivers/target/tcm_vhost/tcm_vhost_scsi.c
> +++ b/drivers/target/tcm_vhost/tcm_vhost_scsi.c
<SNIP>
> @@ -353,33 +353,21 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs)
>
> tv_cmd->tvc_vhost = vs;
>
> - if (unlikely(vq->iov[out + in - 1].iov_len !=
> + if (unlikely(vq->iov[out].iov_len !=
> sizeof(struct virtio_scsi_cmd_resp))) {
> pr_err("Expecting virtio_scsi_cmd_resp, "
> - " got %zu bytes\n", vq->iov[out + in - 1].iov_len);
> + " got %zu bytes, out: %d, in: %d\n", vq->iov[out].iov_len, out, in);
> break;
> }
>
> - tv_cmd->tvc_resp = vq->iov[out + in -1].iov_base;
> + tv_cmd->tvc_resp = vq->iov[out].iov_base;
>
> - if (unlikely(vq->iov[1].iov_len > TCM_VHOST_MAX_CDB_SIZE)) {
> - pr_err("CDB length: %zu exceeds %d\n",
> - vq->iov[1].iov_len, TCM_VHOST_MAX_CDB_SIZE);
> - /* TODO clean up and free tv_cmd */
> - break;
> - }
> /*
> * Copy in the recieved CDB descriptor into tv_cmd->tvc_cdb
> * that will be used by tcm_vhost_new_cmd_map() and down into
> * target_setup_cmd_from_cdb()
> */
> - ret = __copy_from_user(tv_cmd->tvc_cdb, vq->iov[1].iov_base,
> - vq->iov[1].iov_len);
> - if (unlikely(ret)) {
> - pr_err("Faulted on CDB\n");
> - break; /* TODO should all breaks be continues? */
> - }
> -
> + memcpy(tv_cmd->tvc_cdb, v_req.cdb, TCM_VHOST_MAX_CDB_SIZE);
> /*
> * Check that the recieved CDB size does not exceeded our
> * hardcoded max for tcm_vhost
Mmm, the section of this patch for vhost_scsi_handle_vq() does not apply
to the current lio-core.git HEAD.
I've applied this section by hand for now. Also, at little more verbose
changelog would be helpful to other folks reviewing the code. ;)
--nab
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Linux SCSI]
[Kernel Newbies]
[Linux SCSI Target Infrastructure]
[Share Photos]
[IDE]
[Security]
[Git]
[Netfilter]
[Bugtraq]
[Photos]
[Yosemite]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Linux ATA RAID]
[Linux IIO]
[Samba]
[Video 4 Linux]
[Device Mapper]
[Linux Resources]