vhost/scsi: truncate T10 PI iov_iter to prot_bytes
authorGreg Edwards <gedwards@ddn.com>
Wed, 22 Aug 2018 19:21:53 +0000 (13:21 -0600)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 25 Oct 2018 01:16:13 +0000 (21:16 -0400)
commit4542d623c7134bc1738f8a68ccb6dd546f1c264f
tree158c20e9dc8043d6f6d56f01ce6e504b176a7ff6
parent2e991629bcf55a43681aec1ee096eeb03cf81709
vhost/scsi: truncate T10 PI iov_iter to prot_bytes

Commands with protection information included were not truncating the
protection iov_iter to the number of protection bytes in the command.
This resulted in vhost_scsi mis-calculating the size of the protection
SGL in vhost_scsi_calc_sgls(), and including both the protection and
data SG entries in the protection SGL.

Fixes: 09b13fa8c1a1 ("vhost/scsi: Add ANY_LAYOUT support in vhost_scsi_handle_vq")
Signed-off-by: Greg Edwards <gedwards@ddn.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Fixes: 09b13fa8c1a1093e9458549ac8bb203a7c65c62a
Cc: stable@vger.kernel.org
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
drivers/vhost/scsi.c