From: sashiko-bot@kernel.org
To: "Ryosuke Yasuoka" <ryasuoka@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/virtio: defer hotplug event from dequeue worker to avoid deadlock
Date: Tue, 30 Jun 2026 09:36:55 +0000 [thread overview]
Message-ID: <20260630093656.049001F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260630-virtiogpu_syzbot-v1-1-0aa06630750e@redhat.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Flawed driver teardown order allows work items (including the newly added `hotplug_work`) to be re-queued and executed after the device structure and virtqueues are freed.
--
commit 81a0fe4ee345c5c5f16f0048bb1284a83aa82e58
Author: Ryosuke Yasuoka <ryasuoka@redhat.com>
drm/virtio: defer hotplug event from dequeue worker to avoid deadlock
A probe-time deadlock can occur between the dequeue worker and
drm_client_register(). This patch defers the hotplug notification from
virtio_gpu_cmd_get_display_info_cb() to a separate work item to prevent
this deadlock.
Link: https://syzkaller.appspot.com/bug?id=d6dd6f86d3aaf7eebe7406e45c1c6e549453f224
Link: https://syzkaller.appspot.com/bug?id=908bd910da5dd79b88de4cf7baf376cc873a922e
> diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_kms.c
> index cfde9f573df6e..cfb532ba43a47 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_kms.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_kms.c
[ ... ]
> @@ -293,6 +295,7 @@ void virtio_gpu_deinit(struct drm_device *dev)
> flush_work(&vgdev->obj_free_work);
> flush_work(&vgdev->ctrlq.dequeue_work);
> flush_work(&vgdev->cursorq.dequeue_work);
> + flush_work(&vgdev->hotplug_work);
> flush_work(&vgdev->config_changed_work);
> virtio_reset_device(vgdev->vdev);
> vgdev->vdev->config->del_vqs(vgdev->vdev);
[Severity: High]
This is a pre-existing issue, but does this teardown sequence allow work items
to be re-queued after they are flushed?
Here in virtio_gpu_deinit(), the work items are flushed before the device is
reset via virtio_reset_device() and the virtqueues are deleted via del_vqs().
Because the device is still active during the flush, if responses arrive for
shutdown commands (like those queued by drm_atomic_helper_shutdown()), the
interrupt handler can re-queue the work:
virtio_gpu_ctrl_ack()
schedule_work(&vgdev->ctrlq.dequeue_work);
This re-queued dequeue_work can then execute after del_vqs() has freed the
virtqueues, leading to a use-after-free. Furthermore, it could schedule the
newly added hotplug_work:
virtio_gpu_cmd_get_display_info_cb()
schedule_work(&vgdev->hotplug_work);
This would cause further use-after-free access on the freed vgdev structure.
Should the flush_work() calls be moved after virtio_reset_device() to ensure
no new interrupts can re-queue these work items?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260630-virtiogpu_syzbot-v1-1-0aa06630750e@redhat.com?part=1
next prev parent reply other threads:[~2026-06-30 9:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 9:16 [PATCH] drm/virtio: defer hotplug event from dequeue worker to avoid deadlock Ryosuke Yasuoka
2026-06-30 9:36 ` sashiko-bot [this message]
2026-06-30 13:46 ` Dmitry Osipenko
2026-07-01 9:23 ` Ryosuke Yasuoka
2026-07-01 23:43 ` Hillf Danton
2026-07-02 7:12 ` Ryosuke Yasuoka
2026-07-02 8:25 ` Hillf Danton
2026-07-02 11:26 ` Dmitry Osipenko
2026-07-03 5:58 ` Ryosuke Yasuoka
2026-07-07 15:10 ` Dmitry Osipenko
2026-07-09 12:30 ` Ryosuke Yasuoka
2026-07-09 12:55 ` Dmitry Osipenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260630093656.049001F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ryasuoka@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.