lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 5 Oct 2021 03:04:07 -0400
From:   "Michael S. Tsirkin" <>
Cc:     Amit Shah <>, Arnd Bergmann <>,
        Greg Kroah-Hartman <>,
Subject: [PATCH] virtio_console: break out of buf poll on remove

A common pattern for device reset is currently:
.. cleanup ..

reset prevents new interrupts from arriving and waits for interrupt
handlers to finish.

However if - as is common - the handler queues a work request which is
flushed during the cleanup stage, we have code adding buffers / trying
to get buffers while device is reset. Not good.

This was reproduced by running
	modprobe virtio_console
	modprobe -r virtio_console
in a loop.

Fixing this comprehensively needs some thought, and new APIs.
Let's at least handle the specific case of virtio_console
removal that was reported in the field.

Signed-off-by: Michael S. Tsirkin <>
 drivers/char/virtio_console.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 7eaf303a7a86..c852ce0b4d56 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1956,6 +1956,12 @@ static void virtcons_remove(struct virtio_device *vdev)
+	/* Device is going away, exit any polling for buffers */
+	virtio_break_device(vdev);
+	if (use_multiport(portdev))
+		flush_work(&portdev->control_work);
+	else
+		flush_work(&portdev->config_work);
 	/* Disable interrupts for vqs */
 	/* Finish up work that's lined up */

Powered by blists - more mailing lists