Commit 87d6aab2 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull virtio fixes from Michael Tsirkin:
 "Several small bugfixes all over the place.

  Most notably, fixes the vsock allocation with GFP_KERNEL in atomic
  context, which has been triggering warnings for lots of testers"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
  vhost/scsi: null-ptr-dereference in vhost_scsi_get_req()
  vsock/virtio: use GFP_ATOMIC under RCU read lock
  virtio_console: fix misc probe bugs
  virtio_ring: tag event_triggered as racy for KCSAN
  vdpa/octeon_ep: Fix format specifier for pointers in debug messages
parents 8cf0b939 221af82f
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -2006,25 +2006,27 @@ static int virtcons_probe(struct virtio_device *vdev)
		multiport = true;
	}

	err = init_vqs(portdev);
	if (err < 0) {
		dev_err(&vdev->dev, "Error %d initializing vqs\n", err);
		goto free_chrdev;
	}

	spin_lock_init(&portdev->ports_lock);
	INIT_LIST_HEAD(&portdev->ports);
	INIT_LIST_HEAD(&portdev->list);

	virtio_device_ready(portdev->vdev);

	INIT_WORK(&portdev->config_work, &config_work_handler);
	INIT_WORK(&portdev->control_work, &control_work_handler);

	if (multiport) {
		spin_lock_init(&portdev->c_ivq_lock);
		spin_lock_init(&portdev->c_ovq_lock);
	}

	err = init_vqs(portdev);
	if (err < 0) {
		dev_err(&vdev->dev, "Error %d initializing vqs\n", err);
		goto free_chrdev;
	}

	virtio_device_ready(portdev->vdev);

	if (multiport) {
		err = fill_queue(portdev->c_ivq, &portdev->c_ivq_lock);
		if (err < 0) {
			dev_err(&vdev->dev,
+6 −6
Original line number Diff line number Diff line
@@ -475,11 +475,11 @@ int octep_hw_caps_read(struct octep_hw *oct_hw, struct pci_dev *pdev)
		dev_err(dev, "Incomplete PCI capabilities");
		return -EIO;
	}
	dev_info(dev, "common cfg mapped at: 0x%016llx\n", (u64)(uintptr_t)oct_hw->common_cfg);
	dev_info(dev, "device cfg mapped at: 0x%016llx\n", (u64)(uintptr_t)oct_hw->dev_cfg);
	dev_info(dev, "isr cfg mapped at: 0x%016llx\n", (u64)(uintptr_t)oct_hw->isr);
	dev_info(dev, "notify base: 0x%016llx, notify off multiplier: %u\n",
		 (u64)(uintptr_t)oct_hw->notify_base, oct_hw->notify_off_multiplier);
	dev_info(dev, "common cfg mapped at: %p\n", oct_hw->common_cfg);
	dev_info(dev, "device cfg mapped at: %p\n", oct_hw->dev_cfg);
	dev_info(dev, "isr cfg mapped at: %p\n", oct_hw->isr);
	dev_info(dev, "notify base: %p, notify off multiplier: %u\n",
		 oct_hw->notify_base, oct_hw->notify_off_multiplier);

	oct_hw->config_size = octep_get_config_size(oct_hw);
	oct_hw->features = octep_hw_get_dev_features(oct_hw);
@@ -511,7 +511,7 @@ int octep_hw_caps_read(struct octep_hw *oct_hw, struct pci_dev *pdev)
	}
	mbox = octep_get_mbox(oct_hw);
	octep_mbox_init(mbox);
	dev_info(dev, "mbox mapped at: 0x%016llx\n", (u64)(uintptr_t)mbox);
	dev_info(dev, "mbox mapped at: %p\n", mbox);

	return 0;
}
+15 −12
Original line number Diff line number Diff line
@@ -1029,20 +1029,23 @@ vhost_scsi_get_req(struct vhost_virtqueue *vq, struct vhost_scsi_ctx *vc,
		/* virtio-scsi spec requires byte 0 of the lun to be 1 */
		vq_err(vq, "Illegal virtio-scsi lun: %u\n", *vc->lunp);
	} else {
		struct vhost_scsi_tpg **vs_tpg, *tpg;

		vs_tpg = vhost_vq_get_backend(vq);	/* validated at handler entry */
		struct vhost_scsi_tpg **vs_tpg, *tpg = NULL;

		if (vc->target) {
			/* validated at handler entry */
			vs_tpg = vhost_vq_get_backend(vq);
			tpg = READ_ONCE(vs_tpg[*vc->target]);
			if (unlikely(!tpg)) {
				vq_err(vq, "Target 0x%x does not exist\n", *vc->target);
		} else {
				goto out;
			}
		}

		if (tpgp)
			*tpgp = tpg;
		ret = 0;
	}
	}

out:
	return ret;
}

+1 −1
Original line number Diff line number Diff line
@@ -2588,7 +2588,7 @@ irqreturn_t vring_interrupt(int irq, void *_vq)

	/* Just a hint for performance: so it's ok that this can be racy! */
	if (vq->event)
		vq->event_triggered = true;
		data_race(vq->event_triggered = true);

	pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback);
	if (vq->vq.callback)
+4 −4
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ static u32 virtio_transport_get_local_cid(void)

/* Caller need to hold vsock->tx_lock on vq */
static int virtio_transport_send_skb(struct sk_buff *skb, struct virtqueue *vq,
				     struct virtio_vsock *vsock)
				     struct virtio_vsock *vsock, gfp_t gfp)
{
	int ret, in_sg = 0, out_sg = 0;
	struct scatterlist **sgs;
@@ -140,7 +140,7 @@ static int virtio_transport_send_skb(struct sk_buff *skb, struct virtqueue *vq,
		}
	}

	ret = virtqueue_add_sgs(vq, sgs, out_sg, in_sg, skb, GFP_KERNEL);
	ret = virtqueue_add_sgs(vq, sgs, out_sg, in_sg, skb, gfp);
	/* Usually this means that there is no more space available in
	 * the vq
	 */
@@ -178,7 +178,7 @@ virtio_transport_send_pkt_work(struct work_struct *work)

		reply = virtio_vsock_skb_reply(skb);

		ret = virtio_transport_send_skb(skb, vq, vsock);
		ret = virtio_transport_send_skb(skb, vq, vsock, GFP_KERNEL);
		if (ret < 0) {
			virtio_vsock_skb_queue_head(&vsock->send_pkt_queue, skb);
			break;
@@ -221,7 +221,7 @@ static int virtio_transport_send_skb_fast_path(struct virtio_vsock *vsock, struc
	if (unlikely(ret == 0))
		return -EBUSY;

	ret = virtio_transport_send_skb(skb, vq, vsock);
	ret = virtio_transport_send_skb(skb, vq, vsock, GFP_ATOMIC);
	if (ret == 0)
		virtqueue_kick(vq);