linux-stable/drivers/vhost
Pavel Tikhomirov 74ad741948 vhost: return EINVAL if iovecs size does not match the message size
We've failed to copy and process vhost_iotlb_msg so let userspace at
least know about it. For instance before these patch the code below runs
without any error:

int main()
{
  struct vhost_msg msg;
  struct iovec iov;
  int fd;

  fd = open("/dev/vhost-net", O_RDWR);
  if (fd == -1) {
    perror("open");
    return 1;
  }

  iov.iov_base = &msg;
  iov.iov_len = sizeof(msg)-4;

  if (writev(fd, &iov,1) == -1) {
    perror("writev");
    return 1;
  }

  return 0;
}

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2019-01-14 20:28:07 -05:00
..
Kconfig vhost: allow vhost-scsi driver to be built-in 2018-08-22 01:01:32 +03:00
Kconfig.vringh
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
net.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2018-12-27 13:04:52 -08:00
scsi.c virtio, vhost: features, fixes, cleanups 2019-01-02 18:54:45 -08:00
test.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
test.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vhost.c vhost: return EINVAL if iovecs size does not match the message size 2019-01-14 20:28:07 -05:00
vhost.h vhost: switch to use new message format 2018-08-06 10:41:04 -07:00
vringh.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
vsock.c vhost/vsock: switch to a mutex for vhost_vsock_hash 2018-12-19 18:23:49 -05:00