Commit 87d6aab2 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost

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
...@@ -2006,25 +2006,27 @@ static int virtcons_probe(struct virtio_device *vdev) ...@@ -2006,25 +2006,27 @@ static int virtcons_probe(struct virtio_device *vdev)
multiport = true; 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); spin_lock_init(&portdev->ports_lock);
INIT_LIST_HEAD(&portdev->ports); INIT_LIST_HEAD(&portdev->ports);
INIT_LIST_HEAD(&portdev->list); INIT_LIST_HEAD(&portdev->list);
virtio_device_ready(portdev->vdev);
INIT_WORK(&portdev->config_work, &config_work_handler); INIT_WORK(&portdev->config_work, &config_work_handler);
INIT_WORK(&portdev->control_work, &control_work_handler); INIT_WORK(&portdev->control_work, &control_work_handler);
if (multiport) { if (multiport) {
spin_lock_init(&portdev->c_ivq_lock); spin_lock_init(&portdev->c_ivq_lock);
spin_lock_init(&portdev->c_ovq_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); err = fill_queue(portdev->c_ivq, &portdev->c_ivq_lock);
if (err < 0) { if (err < 0) {
dev_err(&vdev->dev, dev_err(&vdev->dev,
......
...@@ -475,11 +475,11 @@ int octep_hw_caps_read(struct octep_hw *oct_hw, struct pci_dev *pdev) ...@@ -475,11 +475,11 @@ int octep_hw_caps_read(struct octep_hw *oct_hw, struct pci_dev *pdev)
dev_err(dev, "Incomplete PCI capabilities"); dev_err(dev, "Incomplete PCI capabilities");
return -EIO; return -EIO;
} }
dev_info(dev, "common cfg mapped at: 0x%016llx\n", (u64)(uintptr_t)oct_hw->common_cfg); dev_info(dev, "common cfg mapped at: %p\n", oct_hw->common_cfg);
dev_info(dev, "device cfg mapped at: 0x%016llx\n", (u64)(uintptr_t)oct_hw->dev_cfg); dev_info(dev, "device cfg mapped at: %p\n", oct_hw->dev_cfg);
dev_info(dev, "isr cfg mapped at: 0x%016llx\n", (u64)(uintptr_t)oct_hw->isr); dev_info(dev, "isr cfg mapped at: %p\n", oct_hw->isr);
dev_info(dev, "notify base: 0x%016llx, notify off multiplier: %u\n", dev_info(dev, "notify base: %p, notify off multiplier: %u\n",
(u64)(uintptr_t)oct_hw->notify_base, oct_hw->notify_off_multiplier); oct_hw->notify_base, oct_hw->notify_off_multiplier);
oct_hw->config_size = octep_get_config_size(oct_hw); oct_hw->config_size = octep_get_config_size(oct_hw);
oct_hw->features = octep_hw_get_dev_features(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) ...@@ -511,7 +511,7 @@ int octep_hw_caps_read(struct octep_hw *oct_hw, struct pci_dev *pdev)
} }
mbox = octep_get_mbox(oct_hw); mbox = octep_get_mbox(oct_hw);
octep_mbox_init(mbox); 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; return 0;
} }
...@@ -1029,20 +1029,23 @@ vhost_scsi_get_req(struct vhost_virtqueue *vq, struct vhost_scsi_ctx *vc, ...@@ -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 */ /* virtio-scsi spec requires byte 0 of the lun to be 1 */
vq_err(vq, "Illegal virtio-scsi lun: %u\n", *vc->lunp); vq_err(vq, "Illegal virtio-scsi lun: %u\n", *vc->lunp);
} else { } else {
struct vhost_scsi_tpg **vs_tpg, *tpg; struct vhost_scsi_tpg **vs_tpg, *tpg = NULL;
vs_tpg = vhost_vq_get_backend(vq); /* validated at handler entry */ if (vc->target) {
/* validated at handler entry */
tpg = READ_ONCE(vs_tpg[*vc->target]); vs_tpg = vhost_vq_get_backend(vq);
if (unlikely(!tpg)) { tpg = READ_ONCE(vs_tpg[*vc->target]);
vq_err(vq, "Target 0x%x does not exist\n", *vc->target); if (unlikely(!tpg)) {
} else { vq_err(vq, "Target 0x%x does not exist\n", *vc->target);
if (tpgp) goto out;
*tpgp = tpg; }
ret = 0;
} }
}
if (tpgp)
*tpgp = tpg;
ret = 0;
}
out:
return ret; return ret;
} }
......
...@@ -2588,7 +2588,7 @@ irqreturn_t vring_interrupt(int irq, void *_vq) ...@@ -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! */ /* Just a hint for performance: so it's ok that this can be racy! */
if (vq->event) 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); pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback);
if (vq->vq.callback) if (vq->vq.callback)
......
...@@ -96,7 +96,7 @@ static u32 virtio_transport_get_local_cid(void) ...@@ -96,7 +96,7 @@ static u32 virtio_transport_get_local_cid(void)
/* Caller need to hold vsock->tx_lock on vq */ /* Caller need to hold vsock->tx_lock on vq */
static int virtio_transport_send_skb(struct sk_buff *skb, struct virtqueue *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; int ret, in_sg = 0, out_sg = 0;
struct scatterlist **sgs; struct scatterlist **sgs;
...@@ -140,7 +140,7 @@ static int virtio_transport_send_skb(struct sk_buff *skb, struct virtqueue *vq, ...@@ -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 /* Usually this means that there is no more space available in
* the vq * the vq
*/ */
...@@ -178,7 +178,7 @@ virtio_transport_send_pkt_work(struct work_struct *work) ...@@ -178,7 +178,7 @@ virtio_transport_send_pkt_work(struct work_struct *work)
reply = virtio_vsock_skb_reply(skb); 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) { if (ret < 0) {
virtio_vsock_skb_queue_head(&vsock->send_pkt_queue, skb); virtio_vsock_skb_queue_head(&vsock->send_pkt_queue, skb);
break; break;
...@@ -221,7 +221,7 @@ static int virtio_transport_send_skb_fast_path(struct virtio_vsock *vsock, struc ...@@ -221,7 +221,7 @@ static int virtio_transport_send_skb_fast_path(struct virtio_vsock *vsock, struc
if (unlikely(ret == 0)) if (unlikely(ret == 0))
return -EBUSY; return -EBUSY;
ret = virtio_transport_send_skb(skb, vq, vsock); ret = virtio_transport_send_skb(skb, vq, vsock, GFP_ATOMIC);
if (ret == 0) if (ret == 0)
virtqueue_kick(vq); virtqueue_kick(vq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment