<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-next.git/drivers/virtio, branch master</title>
<subtitle>Linux kernel latest source</subtitle>
<id>http://mirrors.hust.edu.cn/git/linux-next.git/atom?h=master</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/linux-next.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/'/>
<updated>2026-09-03T20:00:46+00:00</updated>
<entry>
<title>virtio: synchronize callbacks after device reset</title>
<updated>2026-09-03T20:00:46+00:00</updated>
<author>
<name>Michael S. Tsirkin</name>
<email>mst@redhat.com</email>
</author>
<published>2026-09-03T15:28:48+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=c7b215e22feffb36e462749c5a255d72a04bd29d'/>
<id>urn:sha1:c7b215e22feffb36e462749c5a255d72a04bd29d</id>
<content type='text'>
virtio_reset_device says:
	Note: this guarantees that vq callbacks are not in progress
but in practice, only virtio pci correctly synchronizes the cbs.

On other transports, a callback that is already executing, keeps running
while the driver tears down the state it uses.

Move virtio_synchronize_cbs from virtio pci to virtio_reset_device
fixing this for all transports that implement synchronize_cbs().

NB: transports without synchronize_cbs are probably still broken.

Reported-by: Karl Mehltretter &lt;kmehltretter@gmail.com&gt;
Link: https://lore.kernel.org/all/20260818040433.66986-1-kmehltretter@gmail.com/
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio_pci: return IRQ_HANDLED for INTx interrupts</title>
<updated>2026-09-03T20:00:12+00:00</updated>
<author>
<name>Michael S. Tsirkin</name>
<email>mst@redhat.com</email>
</author>
<published>2026-09-03T15:21:32+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=bfb518efc5727e82326979aadb1916babf86e293'/>
<id>urn:sha1:bfb518efc5727e82326979aadb1916babf86e293</id>
<content type='text'>
vp_interrupt() returns the result of vp_vring_interrupt(), so a
config-change interrupt with no virtqueue work is reported as unhandled
on a shared INTx line.

To fix, once the ISR read is non-zero, return IRQ_HANDLED.

Fixes: 77cf524654a8 ("virtio_pci: split up vp_interrupt")
Reported-by: Andrew Stellman &lt;astellman@stellman-greene.com&gt;
Link: https://lore.kernel.org/all/20260407123904.6390-4-astellman@stellman-greene.com/
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio_input: stop callbacks before unregistering input device</title>
<updated>2026-09-03T15:25:02+00:00</updated>
<author>
<name>Karl Mehltretter</name>
<email>kmehltretter@gmail.com</email>
</author>
<published>2026-08-18T04:04:33+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=efa5ab3dea832325ee4eb9fc722d098761e77752'/>
<id>urn:sha1:efa5ab3dea832325ee4eb9fc722d098761e77752</id>
<content type='text'>
virtinput_remove() unregisters the input device, which can free it,
before resetting the virtio device that can still deliver events.

virtinput_recv_events() drops vi-&gt;lock around input_event() and samples
vi-&gt;ready only on loop entry. A callback that has passed that check can
therefore use the freed device, requeue a buffer, and kick the queue
after reset has begun.

A KASAN run with the race window widened reproduced the use-after-free.

Reset the device first, as virtinput_freeze() already does. Recheck
vi-&gt;ready after reacquiring the lock so the callback does not requeue or
kick once teardown starts.

Fixes: 271c865161c5 ("Add virtio-input driver.")
Assisted-by: Claude:claude-fable-5
Signed-off-by: Karl Mehltretter &lt;kmehltretter@gmail.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Message-ID: &lt;20260818040433.66986-3-kmehltretter@gmail.com&gt;
</content>
</entry>
<entry>
<title>virtio_balloon: avoid shrinker execution during PM suspend</title>
<updated>2026-09-03T15:24:59+00:00</updated>
<author>
<name>Link Lin</name>
<email>linkl@google.com</email>
</author>
<published>2026-07-17T00:22:21+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=265abd0926a0555b6146b1afb1eca62a30dea0bb'/>
<id>urn:sha1:265abd0926a0555b6146b1afb1eca62a30dea0bb</id>
<content type='text'>
During PM freeze (e.g. S4 hibernation), virtballoon_freeze() calls
remove_common() which resets the virtio device and deletes all virtqueues.
However, the balloon shrinker remains registered with core MM.

If memory pressure occurs during S4 hibernation image creation/saving, MM
invokes virtio_balloon_shrinker_scan(), which attempts to reclaim free
pages. Although return_free_pages_to_mm() only frees pages back to MM,
reclaiming free pages under memory pressure can trigger page reporting
which might access the deleted reporting virtqueue if it is not yet
frozen, or interact with other parts of the driver in a teardown state.

Avoid this by adding a `suspended` flag to `struct virtio_balloon`. Set
this flag to true in virtballoon_freeze() and false in
virtballoon_restore(). Check this flag in both shrinker callbacks (scan
and count) and return 0 if the device is suspended, preventing any
shrinker execution while virtqueues are deleted. Wrap the lockless reads
in READ_ONCE() and writes in WRITE_ONCE() to prevent compiler
optimization issues and KCSAN data race warnings.

Fixes: 71019de8219b ("virtio_balloon: Add free page hinting support")
Cc: stable@vger.kernel.org
Acked-by: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Link Lin &lt;linkl@google.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Message-ID: &lt;20260717002311.681748-3-linkl@google.com&gt;
</content>
</entry>
<entry>
<title>virtio_pci_modern: avoid infinite loop in vp_reset() on invalid status</title>
<updated>2026-09-03T15:24:58+00:00</updated>
<author>
<name>Abhin Parekadan Jose</name>
<email>abhinjoses@gmail.com</email>
</author>
<published>2026-08-02T17:40:59+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=090a0508a888102347a58b506e677f257179741b'/>
<id>urn:sha1:090a0508a888102347a58b506e677f257179741b</id>
<content type='text'>
vp_reset() polls device_status in a tight loop, waiting for it to read
back as 0 after the reset write. device_status is read via MMIO from
the common configuration structure, which requires the PCI_COMMAND
Memory Space Enable bit to be set. If that bit is cleared while the
device is bound -- e.g. by writing 0x0000 to PCI_COMMAND (config space
offset 4) -- the MMIO read no longer reaches the device and returns
the bus's synthesized all-ones response instead. Since that value can
never legitimately clear to 0, the loop spins forever and hangs the
caller.

Use VIRTIO_STATUS_ERROR() to recognize such values and bail out of the
poll loop instead of looping indefinitely.

Signed-off-by: Abhin Parekadan Jose &lt;abhinjoses@gmail.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Message-ID: &lt;20260802174059.4082-3-abhinjoses@gmail.com&gt;
</content>
</entry>
<entry>
<title>virtio_pci_modern_dev: warn once on invalid status</title>
<updated>2026-09-03T15:24:58+00:00</updated>
<author>
<name>Abhin Parekadan Jose</name>
<email>abhinjoses@gmail.com</email>
</author>
<published>2026-08-02T17:40:58+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=e96c37e9d10a2f89be998cabfb40ebefc3abb1f7'/>
<id>urn:sha1:e96c37e9d10a2f89be998cabfb40ebefc3abb1f7</id>
<content type='text'>
vp_modern_get_status() returns the raw device_status byte as read
from the common configuration structure (struct virtio_pci_common_cfg,
mapped via the VIRTIO_PCI_CAP_COMMON_CFG capability). That byte should
only ever contain some combination of the status bits defined by the
virtio spec (bits 0-3, 6-7); bits 4 and 5 are reserved and a
spec-compliant device must never set them. A value with any other bit
set means either the device is violating the spec, or the read never
reached real device state at all -- e.g. because a write of 0x0000 to
the PCI_COMMAND register (config space offset 4) clears the Memory
Space Enable bit, causing the device to stop responding to
memory-mapped register accesses -- effectively simulating an
unresponsive/removed device without a real hot-unplug. In that case
the MMIO read returns the bus's synthesized all-ones response instead
of real device state.

Add VIRTIO_STATUS_ERROR() to the uapi header to recognize such values,
and warn once from vp_modern_get_status() when it sees one, so the
bogus status is visible at its source rather than only showing up as
confusing behavior in callers.

Signed-off-by: Abhin Parekadan Jose &lt;abhinjoses@gmail.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Message-ID: &lt;20260802174059.4082-2-abhinjoses@gmail.com&gt;
</content>
</entry>
<entry>
<title>virtio-vdpa: Use queue id when setting vq affinity</title>
<updated>2026-09-03T15:24:58+00:00</updated>
<author>
<name>Xiong Weimin</name>
<email>xiongweimin@kylinos.cn</email>
</author>
<published>2026-08-04T09:26:49+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=3e5115532aa66ab8eb045f7779162235b40ea465'/>
<id>urn:sha1:3e5115532aa66ab8eb045f7779162235b40ea465</id>
<content type='text'>
When optional queues are skipped, pass the compressed vDPA queue id to
set_vq_affinity() so affinity is applied to the queue that was actually
created.

Signed-off-by: Xiong Weimin &lt;xiongweimin@kylinos.cn&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Message-ID: &lt;20260804092649.1344478-1-xiongweimin@kylinos.cn&gt;
</content>
</entry>
<entry>
<title>virtio_input: reset device if input_register_device() fails</title>
<updated>2026-09-03T15:24:56+00:00</updated>
<author>
<name>Xiong Weimin</name>
<email>xiongweimin@kylinos.cn</email>
</author>
<published>2026-08-05T03:29:31+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=da06134caa68389cefee3377a917e296bb1ba9b0'/>
<id>urn:sha1:da06134caa68389cefee3377a917e296bb1ba9b0</id>
<content type='text'>
Probe marks the device DRIVER_OK with virtio_device_ready() before
calling input_register_device(). If registration fails, the error path
cleared vi-&gt;ready and called del_vqs() while the device was still live,
so the device could keep DMA to queues that were already torn down.

Match remove/freeze: call virtio_reset_device() on that path before
tearing down the virtqueues.

Fixes: 271c865161c5 ("Add virtio-input driver.")
Cc: stable@vger.kernel.org
Signed-off-by: Xiong Weimin &lt;xiongweimin@kylinos.cn&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Message-ID: &lt;20260805032931.1606652-1-xiongweimin@kylinos.cn&gt;
</content>
</entry>
<entry>
<title>virtio_mmio: disable IRQ wake before free_irq</title>
<updated>2026-09-03T15:24:55+00:00</updated>
<author>
<name>Xiong Weimin</name>
<email>xiongweimin@kylinos.cn</email>
</author>
<published>2026-08-05T03:29:37+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=a299deaa914d935a6e268a1be36aaf9871b9620e'/>
<id>urn:sha1:a299deaa914d935a6e268a1be36aaf9871b9620e</id>
<content type='text'>
When the DT node has "wakeup-source", vm_find_vqs() calls
enable_irq_wake() on the shared IRQ, but vm_del_vqs() freed that IRQ
without a matching disable_irq_wake(). That leaves a wake reference
behind and can warn on later free_irq()/request_irq() cycles.

Record whether enable_irq_wake() succeeded, and disable it in
vm_del_vqs() before free_irq().

Fixes: 02213273f72a ("virtio_mmio: add support to set IRQ of a virtio device as wakeup source")
Cc: stable@vger.kernel.org
Signed-off-by: Xiong Weimin &lt;xiongweimin@kylinos.cn&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Message-ID: &lt;20260805032937.1606737-1-xiongweimin@kylinos.cn&gt;
</content>
</entry>
<entry>
<title>virtio: fix use-after-free in unregister_virtio_device()</title>
<updated>2026-09-03T15:24:52+00:00</updated>
<author>
<name>Karl Mehltretter</name>
<email>kmehltretter@gmail.com</email>
</author>
<published>2026-08-21T21:39:53+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=a4608a9befcbf6b5f92da0cda87a2e4cb6673ac5'/>
<id>urn:sha1:a4608a9befcbf6b5f92da0cda87a2e4cb6673ac5</id>
<content type='text'>
device_unregister() is device_del() plus put_device(). When the caller
holds no extra reference, that drops the last one and runs the release
callback, which for several transports frees the memory the embedded
struct virtio_device sits in. unregister_virtio_device() then calls
virtio_debug_device_exit(), which reads dev-&gt;debugfs_dir out of the freed
object.

Affected transports are the ones whose release callback frees and whose
remove path takes no reference: virtio_mmio, virtio_vdpa, virtio_uml,
mlxbf-tmfifo and virtio_ccw. virtio_pci is unaffected because
virtio_pci_remove() brackets the call with get_device() and put_device().

Remove the debugfs entries before the device can go away. They are only
accessed through the protected debugfs interface, so
debugfs_remove_recursive() waits for in-progress file operations before
returning. Tearing them down while the device is still alive is therefore
safe.

Reproduced on User-Mode Linux with CONFIG_KASAN and CONFIG_VIRTIO_DEBUG
by unbinding a virtio-uml device:

  BUG: KASAN: slab-use-after-free in virtio_debug_device_exit+0x36/0x4d
  Read of size 8 at addr 00000000616e0b10 by task init/1
   __asan_report_load8_noabort
   virtio_debug_device_exit+0x36/0x4d
   unregister_virtio_device+0x48/0x75
   virtio_uml_remove
   platform_remove
   device_release_driver_internal
   unbind_store

  Freed by task 1:
   kfree
   virtio_uml_release_dev
   device_release
   kobject_put
   put_device
   device_unregister

With this applied, the report is gone and unbind is clean.

Fixes: 96a8326d69ff ("virtio: add debugfs infrastructure to allow to debug virtio features")
Assisted-by: Claude:claude-opus-5
Signed-off-by: Karl Mehltretter &lt;kmehltretter@gmail.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Message-ID: &lt;20260821213953.76906-1-kmehltretter@gmail.com&gt;
</content>
</entry>
</feed>
