Skip to content

Commit 87d6aab

Browse files
committed
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
2 parents 8cf0b93 + 221af82 commit 87d6aab

5 files changed

Lines changed: 36 additions & 31 deletions

File tree

drivers/char/virtio_console.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2006,25 +2006,27 @@ static int virtcons_probe(struct virtio_device *vdev)
20062006
multiport = true;
20072007
}
20082008

2009-
err = init_vqs(portdev);
2010-
if (err < 0) {
2011-
dev_err(&vdev->dev, "Error %d initializing vqs\n", err);
2012-
goto free_chrdev;
2013-
}
2014-
20152009
spin_lock_init(&portdev->ports_lock);
20162010
INIT_LIST_HEAD(&portdev->ports);
20172011
INIT_LIST_HEAD(&portdev->list);
20182012

2019-
virtio_device_ready(portdev->vdev);
2020-
20212013
INIT_WORK(&portdev->config_work, &config_work_handler);
20222014
INIT_WORK(&portdev->control_work, &control_work_handler);
20232015

20242016
if (multiport) {
20252017
spin_lock_init(&portdev->c_ivq_lock);
20262018
spin_lock_init(&portdev->c_ovq_lock);
2019+
}
20272020

2021+
err = init_vqs(portdev);
2022+
if (err < 0) {
2023+
dev_err(&vdev->dev, "Error %d initializing vqs\n", err);
2024+
goto free_chrdev;
2025+
}
2026+
2027+
virtio_device_ready(portdev->vdev);
2028+
2029+
if (multiport) {
20282030
err = fill_queue(portdev->c_ivq, &portdev->c_ivq_lock);
20292031
if (err < 0) {
20302032
dev_err(&vdev->dev,

drivers/vdpa/octeon_ep/octep_vdpa_hw.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -475,11 +475,11 @@ int octep_hw_caps_read(struct octep_hw *oct_hw, struct pci_dev *pdev)
475475
dev_err(dev, "Incomplete PCI capabilities");
476476
return -EIO;
477477
}
478-
dev_info(dev, "common cfg mapped at: 0x%016llx\n", (u64)(uintptr_t)oct_hw->common_cfg);
479-
dev_info(dev, "device cfg mapped at: 0x%016llx\n", (u64)(uintptr_t)oct_hw->dev_cfg);
480-
dev_info(dev, "isr cfg mapped at: 0x%016llx\n", (u64)(uintptr_t)oct_hw->isr);
481-
dev_info(dev, "notify base: 0x%016llx, notify off multiplier: %u\n",
482-
(u64)(uintptr_t)oct_hw->notify_base, oct_hw->notify_off_multiplier);
478+
dev_info(dev, "common cfg mapped at: %p\n", oct_hw->common_cfg);
479+
dev_info(dev, "device cfg mapped at: %p\n", oct_hw->dev_cfg);
480+
dev_info(dev, "isr cfg mapped at: %p\n", oct_hw->isr);
481+
dev_info(dev, "notify base: %p, notify off multiplier: %u\n",
482+
oct_hw->notify_base, oct_hw->notify_off_multiplier);
483483

484484
oct_hw->config_size = octep_get_config_size(oct_hw);
485485
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)
511511
}
512512
mbox = octep_get_mbox(oct_hw);
513513
octep_mbox_init(mbox);
514-
dev_info(dev, "mbox mapped at: 0x%016llx\n", (u64)(uintptr_t)mbox);
514+
dev_info(dev, "mbox mapped at: %p\n", mbox);
515515

516516
return 0;
517517
}

drivers/vhost/scsi.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,20 +1029,23 @@ vhost_scsi_get_req(struct vhost_virtqueue *vq, struct vhost_scsi_ctx *vc,
10291029
/* virtio-scsi spec requires byte 0 of the lun to be 1 */
10301030
vq_err(vq, "Illegal virtio-scsi lun: %u\n", *vc->lunp);
10311031
} else {
1032-
struct vhost_scsi_tpg **vs_tpg, *tpg;
1033-
1034-
vs_tpg = vhost_vq_get_backend(vq); /* validated at handler entry */
1035-
1036-
tpg = READ_ONCE(vs_tpg[*vc->target]);
1037-
if (unlikely(!tpg)) {
1038-
vq_err(vq, "Target 0x%x does not exist\n", *vc->target);
1039-
} else {
1040-
if (tpgp)
1041-
*tpgp = tpg;
1042-
ret = 0;
1032+
struct vhost_scsi_tpg **vs_tpg, *tpg = NULL;
1033+
1034+
if (vc->target) {
1035+
/* validated at handler entry */
1036+
vs_tpg = vhost_vq_get_backend(vq);
1037+
tpg = READ_ONCE(vs_tpg[*vc->target]);
1038+
if (unlikely(!tpg)) {
1039+
vq_err(vq, "Target 0x%x does not exist\n", *vc->target);
1040+
goto out;
1041+
}
10431042
}
1044-
}
10451043

1044+
if (tpgp)
1045+
*tpgp = tpg;
1046+
ret = 0;
1047+
}
1048+
out:
10461049
return ret;
10471050
}
10481051

drivers/virtio/virtio_ring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2588,7 +2588,7 @@ irqreturn_t vring_interrupt(int irq, void *_vq)
25882588

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

25932593
pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback);
25942594
if (vq->vq.callback)

net/vmw_vsock/virtio_transport.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static u32 virtio_transport_get_local_cid(void)
9696

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

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

179179
reply = virtio_vsock_skb_reply(skb);
180180

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

224-
ret = virtio_transport_send_skb(skb, vq, vsock);
224+
ret = virtio_transport_send_skb(skb, vq, vsock, GFP_ATOMIC);
225225
if (ret == 0)
226226
virtqueue_kick(vq);
227227

0 commit comments

Comments
 (0)