Commit 5472f14a authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull virtio fixes from Michael Tsirkin:
 "Misc virtio and vdpa bugfixes"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
  vdpa: Consider device id larger than 31
  virtio/vsock: fix the transport to work with VMADDR_CID_ANY
  virtio_ring: Fix querying of maximum DMA mapping size for virtio device
  virtio: always enter drivers/virtio/
  vduse: check that offset is within bounds in get_config()
  vdpa: check that offsets are within bounds
  vduse: fix memory corruption in vduse_dev_ioctl()
parents aa50faff bb47620b
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -41,8 +41,7 @@ obj-$(CONFIG_DMADEVICES) += dma/
# SOC specific infrastructure drivers.
obj-y				+= soc/

obj-$(CONFIG_VIRTIO)		+= virtio/
obj-$(CONFIG_VIRTIO_PCI_LIB)	+= virtio/
obj-y				+= virtio/
obj-$(CONFIG_VDPA)		+= vdpa/
obj-$(CONFIG_XEN)		+= xen/

+2 −1
Original line number Diff line number Diff line
@@ -404,7 +404,8 @@ static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *m
		goto msg_err;

	while (mdev->id_table[i].device) {
		supported_classes |= BIT(mdev->id_table[i].device);
		if (mdev->id_table[i].device <= 63)
			supported_classes |= BIT_ULL(mdev->id_table[i].device);
		i++;
	}

+4 −2
Original line number Diff line number Diff line
@@ -655,7 +655,8 @@ static void vduse_vdpa_get_config(struct vdpa_device *vdpa, unsigned int offset,
{
	struct vduse_dev *dev = vdpa_to_vduse(vdpa);

	if (len > dev->config_size - offset)
	if (offset > dev->config_size ||
	    len > dev->config_size - offset)
		return;

	memcpy(buf, dev->config + offset, len);
@@ -975,7 +976,8 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd,
			break;

		ret = -EINVAL;
		if (config.length == 0 ||
		if (config.offset > dev->config_size ||
		    config.length == 0 ||
		    config.length > dev->config_size - config.offset)
			break;

+1 −1
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ static int vhost_vdpa_config_validate(struct vhost_vdpa *v,
	struct vdpa_device *vdpa = v->vdpa;
	long size = vdpa->config->get_config_size(vdpa);

	if (c->len == 0)
	if (c->len == 0 || c->off > size)
		return -EINVAL;

	if (c->len > size - c->off)
+1 −1
Original line number Diff line number Diff line
@@ -268,7 +268,7 @@ size_t virtio_max_dma_size(struct virtio_device *vdev)
	size_t max_segment_size = SIZE_MAX;

	if (vring_use_dma_api(vdev))
		max_segment_size = dma_max_mapping_size(&vdev->dev);
		max_segment_size = dma_max_mapping_size(vdev->dev.parent);

	return max_segment_size;
}
Loading