HomeFreeBSD

Fix several iov handling bugs in bhyve virtio-scsi backend.

Description

Fix several iov handling bugs in bhyve virtio-scsi backend.

  • buf_to_iov() does not use buflen parameter, allowing out of bound read.
  • buf_to_iov() leaks memory if seek argument > 0.
  • iov_to_buf() doesn't need to reallocate buffer for every segment.
  • there is no point to use size_t for iov counts, int is more then enough.
  • some iov function arguments can be constified.
  • pci_vtscsi_request_handle() used truncate_iov() incorrectly, allowing getting out of buffer and possibly corrupting data.
  • pci_vtscsi_controlq_notify() written returned status at wrong offset.
  • pci_vtscsi_controlq_notify() leaked one buffer per event.

Reported by: wg
Reviewed by: araujo
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D18465

Details

Provenance
mavAuthored on
Reviewer
araujo
Differential Revision
D18465: Several iov handling bugs in bhyve virtio-scsi backend
Parents
rS341704: Fill initid explicitly on requests.
Branches
Unknown
Tags
Unknown