Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+35 -30
+10 -8
drivers/char/virtio_console.c
··· 2006 2006 multiport = true; 2007 2007 } 2008 2008 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 - 2015 2009 spin_lock_init(&portdev->ports_lock); 2016 2010 INIT_LIST_HEAD(&portdev->ports); 2017 2011 INIT_LIST_HEAD(&portdev->list); 2018 - 2019 - virtio_device_ready(portdev->vdev); 2020 2012 2021 2013 INIT_WORK(&portdev->config_work, &config_work_handler); 2022 2014 INIT_WORK(&portdev->control_work, &control_work_handler); ··· 2016 2024 if (multiport) { 2017 2025 spin_lock_init(&portdev->c_ivq_lock); 2018 2026 spin_lock_init(&portdev->c_ovq_lock); 2027 + } 2019 2028 2029 + err = init_vqs(portdev); 2030 + if (err < 0) { 2031 + dev_err(&vdev->dev, "Error %d initializing vqs\n", err); 2032 + goto free_chrdev; 2033 + } 2034 + 2035 + virtio_device_ready(portdev->vdev); 2036 + 2037 + if (multiport) { 2020 2038 err = fill_queue(portdev->c_ivq, &portdev->c_ivq_lock); 2021 2039 if (err < 0) { 2022 2040 dev_err(&vdev->dev,
+6 -6
drivers/vdpa/octeon_ep/octep_vdpa_hw.c
··· 475 475 dev_err(dev, "Incomplete PCI capabilities"); 476 476 return -EIO; 477 477 } 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); 483 483 484 484 oct_hw->config_size = octep_get_config_size(oct_hw); 485 485 oct_hw->features = octep_hw_get_dev_features(oct_hw); ··· 511 511 } 512 512 mbox = octep_get_mbox(oct_hw); 513 513 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); 515 515 516 516 return 0; 517 517 }
+14 -11
drivers/vhost/scsi.c
··· 1029 1029 /* virtio-scsi spec requires byte 0 of the lun to be 1 */ 1030 1030 vq_err(vq, "Illegal virtio-scsi lun: %u\n", *vc->lunp); 1031 1031 } else { 1032 - struct vhost_scsi_tpg **vs_tpg, *tpg; 1032 + struct vhost_scsi_tpg **vs_tpg, *tpg = NULL; 1033 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; 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 + } 1043 1042 } 1044 - } 1045 1043 1044 + if (tpgp) 1045 + *tpgp = tpg; 1046 + ret = 0; 1047 + } 1048 + out: 1046 1049 return ret; 1047 1050 } 1048 1051
+1 -1
drivers/virtio/virtio_ring.c
··· 2588 2588 2589 2589 /* Just a hint for performance: so it's ok that this can be racy! */ 2590 2590 if (vq->event) 2591 - vq->event_triggered = true; 2591 + data_race(vq->event_triggered = true); 2592 2592 2593 2593 pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback); 2594 2594 if (vq->vq.callback)
+4 -4
net/vmw_vsock/virtio_transport.c
··· 96 96 97 97 /* Caller need to hold vsock->tx_lock on vq */ 98 98 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) 100 100 { 101 101 int ret, in_sg = 0, out_sg = 0; 102 102 struct scatterlist **sgs; ··· 140 140 } 141 141 } 142 142 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); 144 144 /* Usually this means that there is no more space available in 145 145 * the vq 146 146 */ ··· 178 178 179 179 reply = virtio_vsock_skb_reply(skb); 180 180 181 - ret = virtio_transport_send_skb(skb, vq, vsock); 181 + ret = virtio_transport_send_skb(skb, vq, vsock, GFP_KERNEL); 182 182 if (ret < 0) { 183 183 virtio_vsock_skb_queue_head(&vsock->send_pkt_queue, skb); 184 184 break; ··· 221 221 if (unlikely(ret == 0)) 222 222 return -EBUSY; 223 223 224 - ret = virtio_transport_send_skb(skb, vq, vsock); 224 + ret = virtio_transport_send_skb(skb, vq, vsock, GFP_ATOMIC); 225 225 if (ret == 0) 226 226 virtqueue_kick(vq); 227 227