diff options
| author | Mark Brown <broonie@kernel.org> | 2026-09-07 14:47:54 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-09-07 14:47:54 +0100 |
| commit | 865b9b981e69618333fed8f6cf7375a413868f3c (patch) | |
| tree | 8e3e492af1fbc1f26ffd6381247aefa62fcf79dd /drivers/char | |
| parent | 8880a2480eab95a57cd238a49b387c16dfeae8b1 (diff) | |
| parent | f49e6cf919425cc55f10fd7cda7e0fc895df4cc0 (diff) | |
| download | linux-next-865b9b981e69618333fed8f6cf7375a413868f3c.tar.gz linux-next-865b9b981e69618333fed8f6cf7375a413868f3c.zip | |
Merge branch 'linux-next' of https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git
Diffstat (limited to 'drivers/char')
| -rw-r--r-- | drivers/char/virtio_console.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 7f6cbe851d1e..019bcae81af5 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -1964,13 +1964,28 @@ static const struct file_operations portdev_fops = { static void remove_vqs(struct ports_device *portdev) { struct virtqueue *vq; + bool multiport = use_multiport(portdev); virtio_device_for_each_vq(portdev->vdev, vq) { struct port_buffer *buf; + unsigned int len; - flush_bufs(vq, true); - while ((buf = virtqueue_detach_unused_buf(vq))) - free_buf(buf, true); + /* + * c_ovq cookies are &portdev->cpkt, not port_buffer. + * Detach them but do not free_buf(). + */ + if (multiport && vq == portdev->c_ovq) { + spin_lock(&portdev->c_ovq_lock); + while (virtqueue_get_buf(vq, &len)) + ; + while (virtqueue_detach_unused_buf(vq)) + ; + spin_unlock(&portdev->c_ovq_lock); + } else { + flush_bufs(vq, true); + while ((buf = virtqueue_detach_unused_buf(vq))) + free_buf(buf, true); + } cond_resched(); } portdev->vdev->config->del_vqs(portdev->vdev); |
