Skip to contentSkip to conversation

vhost,virtio,vdpa: bugfixes

GIT PULL Merged Michael S. Tsirkin 5 participants 6 messages Nov 4 – Nov 25

Subsystems (5)
lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

The following changes since commit 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4:

Linux 7.4-rc1 (2026-11-01 13:26:31 -0800)

are available in the Git repository at:

https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git tags/for_linus

for you to fetch changes up to 1a577f9402c1780cc1e663f48d5dd54c02051b09:

virtio_pci: don't take the MSI mutex under cpu_hotplug_lock (2026-11-03 07:32:14 -0500)

----------------------------------------------------------------
vhost,virtio,vdpa: bugfixes

Just a bunch of fixes all over the place.

----------------------------------------------------------------
Dudu Lu (1):
vhost/vringh: Fix IOTLB permission in putu16_iotlb()

Eugenio Pérez (1):
MAINTAINERS: add missing virtio/vdpa/vduse/vhost headers

Fang Xieyan (4):
vringh: bound top-level re-entry into indirect tables
vringh: add regression test for cyclic indirect descriptor
vringh: reject empty / undersized indirect descriptor tables
vhost: fix used ring index wrap in vhost_add_used_n_in_order

Jia Jia (5):
vhost-scsi: preserve event ordering
vhost-scsi: do not relock event vq mutex on send_evt fallback
vduse: avoid infinite loop when no affinity CPU is online
vhost-scsi: do not count PI bytes in the data length
vhost-scsi: fix page reference leak in misaligned I/O fallback

Karl Mehltretter (1):
virtio-spi: Fix virtio_spi_config kernel-doc

Li RongQing (1):
virtio_ring: reset IN_ORDER state in virtqueue_init()

Linfeng Sun (8):
vdpa_sim: serialize IOTLB updates with dataplane access
vdpa: invalidate DMA mappings before releasing memory
vhost: fix dirty logging for in-order used ring entries
vhost: reject invalid IOTLB update permissions
vhost-scsi: validate event queue descriptor direction
vhost-scsi: reject delayed virtqueue setup
vhost: reject backend enable without a kick file
vhost-vdpa: initialize state before publishing cdev

Maoxia (1):
virtio_pci: add missing newline to the pmcsr error message

Mingbing Zhai (1):
virtio_balloon: initialize wakeup_lock before virtqueues are set up

Sergii Ushakov (1):
virtio-blk: clamp max_segments to virtqueue ring size

Shubham Antil (1):
vhost-scsi: zero misaligned I/O bounce pages

Tal Zussman (2):
vhost-vdpa: fix pinned page leak in vhost_vdpa_pa_map() error path
vhost-vdpa: unpin mappings by range

Thorsten Blum (1):
hwrng: virtio - prevent use-after-free after a failed restore

Wei-Shuo Chen (1):
virtio: use consistent virtqueue terminology

Xiang Mei (1):
vdpa: fix double free of the reply skb in vdpa_nl_cmd_dev_config_get_doit()

Yu Zhang (1):
vhost-vdpa: drop the parent's vq callback before the call fd is released

Yuho Choi (3):
virtio_blk: Reset device on probe error paths after DRIVER_OK iommu/virtio: Reset device before deleting virtqueues on probe failure vdpa/snet: Don't discard the DPU error in snet_send_ctrl_msg()

Zenghui Yu (Huawei) (1):
virtio_pci: don't take the MSI mutex under cpu_hotplug_lock

chenglong.ma (1):
vduse: fix VA/PA confusion in the coherent page fault path

sungbyeongchan (1):
virtio_ring: use shadow flags when detaching split descriptors

zhang jiao (1):
virtio_ring: Initialize id field in packed indirect descriptors

 MAINTAINERS                          |   4 ++
 drivers/block/virtio_blk.c           |  45 +++++++++++++-
 drivers/char/hw_random/virtio-rng.c  |   7 +++
 drivers/iommu/virtio-iommu.c         |   6 +-
 drivers/vdpa/mlx5/net/mlx5_vnet.c    |  10 ++-
 drivers/vdpa/solidrun/snet_ctrl.c    |   3 +-
 drivers/vdpa/vdpa.c                  |   7 ++-
 drivers/vdpa/vdpa_sim/vdpa_sim.c     |   7 +++
 drivers/vdpa/vdpa_user/iova_domain.c |  11 +++-
 drivers/vdpa/vdpa_user/vduse_dev.c   |  15 +++--
 drivers/vhost/scsi.c                 |  68 +++++++++++++++++----
 drivers/vhost/test.c                 |   4 ++
 drivers/vhost/vdpa.c                 | 115 ++++++++++++++++++++++++-----------
 drivers/vhost/vhost.c                |  36 ++++++++---
 drivers/vhost/vringh.c               |  29 ++++-----
 drivers/virtio/virtio_balloon.c      |   3 +-
 drivers/virtio/virtio_mmio.c         |   2 +-
 drivers/virtio/virtio_pci_common.c   |  12 +++-
 drivers/virtio/virtio_pci_common.h   |   5 +-
 drivers/virtio/virtio_ring.c         |  13 +++-
 include/uapi/linux/virtio_spi.h      |   2 +-
 tools/virtio/vringh_test.c           |  41 +++++++++++++
 22 files changed, 347 insertions(+), 98 deletions(-)
#1 lore raw
Quoted 46 lines · Paul Moses
Quoted 16 lines · Michael S. Tsirkin
Quoted 15 lines · Paul Moses
Quoted 12 lines
Quoted 7 lines

Indeed, seems legit, thanks!

The only thing is that I dislike two error handling paths here. So I wonder why isn't this as simple as fixing the double free directly:

That works for me, should I send it out?

Thanks,
Paul

Quoted 14 lines
Quoted 3 lines

Please do.

Oh and I forgot

Quoted 3 lines

--
MST

Considering that this pattern has occurred in multiple independent source files, maybe it is worth it to make intent more clear? What about this?

Quoted 1 line

From c3b9431dc736cec60c0b288b13d9fa718341f46a Mon Sep 17 00:00:00 2001

From: Paul Moses <[email protected]>
Date: Tue, 10 Mar 2026 15:23:58 -0500
Subject: [PATCH] vdpa: don't free reply skb after genlmsg_reply()

genlmsg_reply() hands the reply skb to netlink, and netlink_unicast() consumes it on all return paths, whether the skb is queued successfully or freed on an error path.

vdpa_nl_cmd_dev_config_get_doit() currently jumps to nlmsg_free(msg) after genlmsg_reply() fails, which can hit the same skb twice.

Quoted 7 lines

Return the genlmsg_reply() error directly and keep nlmsg_free() only for pre-reply failures.

Fixes ad69dd0bf26b ("vdpa: Introduce query of device config layout")

I like crediting people for their work. Let's do this. Pls post as a proper patch starting a new thread, so all 0day tooling catches this, and I'll apply. I'll then apply a rework removing the duplication, on top. Thanks!

Quoted 33 lines
---
 drivers/vdpa/vdpa.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/vdpa/vdpa.c +8 -5
index 34874beb0152e..702d3a7772219 100644
@@ -1352,15 +1352,19 @@ static int vdpa_nl_cmd_dev_config_get_doit(struct sk_buff *skb, struct genl_info
 	}
 	err = vdpa_dev_config_fill(vdev, msg, info->snd_portid, info->snd_seq,
 				   0, info->extack);
-	if (!err)
-		err = genlmsg_reply(msg, info);
+	if (err)
+		goto mdev_err;
+
+	put_device(dev);
+	up_read(&vdpa_dev_lock);
+
+	return genlmsg_reply(msg, info);
 
 mdev_err:
 	put_device(dev);
 dev_err:
 	up_read(&vdpa_dev_lock);
-	if (err)
-		nlmsg_free(msg);
+	nlmsg_free(msg);
 	return err;
 }
 
--
Quoted 2 lines

2.53.GIT

It's obvious now your intention was always to diminish my contribution. This really only reflects negatively on you.

You or claude didn't even disassemble it. It's slop. My patch is objectively superior both in human readability and performance.

merge bot Merged
#2 lore raw
In reply to Michael S. Tsirkin
The pull request you sent on Wed, 4 Nov 2026 08:15:35 -0500:

The pull request you sent on Wed, 4 Nov 2026 08:15:35 -0500:

Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git tags/for_linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/69e2b55fc3b4fa3639b8c320374c255f046ddda5

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html
#3 lore raw
In reply to Michael S. Tsirkin
Quoted 2 lines · Michael S. Tsirkin

chenglong.ma (1):
vduse: fix VA/PA confusion in the coherent page fault path

This has landed as commit bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path") but I don't see the patch anywhere on lore (off-list security report?)

Anyway, clearly nobody actually _ran_ this code in 7.4, not even claude, as it's completely broken.

Commit 99fd6bf43d5d ("mm/vma: enforce that mm-managed mappings may not set VMA_IO_BIT") literally made setting VM_IO incorrectly, like this patch does, a WARN_ON error on mmap(), i.e. it _refuses_ to mmap it :)

It looks like it doesn't need VM_IO anyway, the other changes in the patch make it redundant AFAICT, so you should send something like the below with a Fixes pointing at bb2e6f166547:

drivers/vdpa/vdpa_user/iova_domain.c +0 -0
@@ static int vduse_domain_mmap(struct file *file, struct vm_area_struct *vma)
-       vm_flags_set(vma, VM_IO | VM_DONTDUMP | VM_DONTEXPAND);
+       vm_flags_set(vma, VM_DONTDUMP | VM_DONTEXPAND);

--
Cheers, Lorenzo

#4 lore raw
Quoted 3 lines · Lorenzo Stoakes (ARM)

It looks like it doesn't need VM_IO anyway, the other changes in the patch make it redundant AFAICT, so you should send something like the below with a Fixes pointing at bb2e6f166547:

Sorry about that: it went to [email protected] (hence no lore thread), I did not test it on 7.4-rc, and you're right that VM_IO is redundant, since vduse_domain_set_map() is the only way vhost-vdpa entries reach the domain iotlb and it already rejects anything backed by the domain file.

I'll send the one-liner with Fixes: bb2e6f166547 and your Reported-by and Suggested-by once I have actually run it on current mainline.

Thanks for catching this.

#5 lore raw
Quoted 10 lines · chenglong.ma
Quoted 3 lines · Lorenzo Stoakes (ARM)

It looks like it doesn't need VM_IO anyway, the other changes in the patch make it redundant AFAICT, so you should send something like the below with a Fixes pointing at bb2e6f166547:

Sorry about that: it went to [email protected] (hence no lore thread), I did not test it on 7.4-rc, and you're right that VM_IO is redundant, since vduse_domain_set_map() is the only way vhost-vdpa entries reach the domain iotlb and it already rejects anything backed by the domain file.

Please, in future, when you submit something for a kernel release, test your change against that kernel release :) or get your LLM to ;)

Quoted 3 lines

I'll send the one-liner with Fixes: bb2e6f166547 and your Reported-by and Suggested-by once I have actually run it on current mainline.

Thanks!

Quoted 2 lines

Thanks for catching this.

--
Cheers, Lorenzo