Linux virtualization list
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yaohan Li" <shunsheng1218@gmail.com>
Cc: virtualization@lists.linux.dev,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH v2] virtio_console: defer HVC polling out of the virtqueue callback
Date: Thu, 05 Nov 2026 12:00:22 +0000	[thread overview]
Message-ID: <sashiko-outbox-198979@kernel.org> (raw)
In-Reply-To: <20261105114450.971521-1-shunsheng1218@gmail.com>

> The input virtqueue callback calls hvc_poll() on port->cons.hvc
> without any synchronization against HVC adapter removal.  A port
> removed via a VIRTIO_CONSOLE_PORT_REMOVE control message runs
> unplug_port() -> hvc_remove(), which drops the adapter's last
> tty_port reference and frees it, while the callback may still be
> about to dereference the freed adapter:
> 
>     BUG: KASAN: slab-use-after-free in _raw_spin_lock_irqsave
>     BUG: KASAN: slab-use-after-free in __hvc_poll
> 
> Both sides hold only the port kref; nothing protects
> struct hvc_struct between the callback's pointer read and its use.
> 
> Do not touch the adapter from hard IRQ context at all.  Only wake
> the HVC worker with hvc_kick(): khvcd polls registered adapters
> [ ... ]
> This issue was investigated and the fix was developed with AI
> assistance (ZCode/GLM-4).
> 
> Fixes: 203baab8ba319 ("virtio: console: Introduce function to hand off data from host to readers")
> Signed-off-by: Yaohan Li <shunsheng1218@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261105114450.971521-1-shunsheng1218@gmail.com?part=1


      reply	other threads:[~2026-11-05 12:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 11:44 [PATCH v2] virtio_console: defer HVC polling out of the virtqueue callback Yaohan Li
2026-11-05 12:00 ` sashiko-bot [this message]

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=sashiko-outbox-198979@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=eperezma@redhat.com \
    --cc=mst@redhat.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shunsheng1218@gmail.com \
    --cc=virtualization@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox