diff options
| author | Michael S. Tsirkin <mst@redhat.com> | 2026-07-05 05:38:57 -0400 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2026-08-03 23:08:15 -0400 |
| commit | 60039faf8135ff05714a2014e54597ebfe07340f (patch) | |
| tree | 8196f74a6e9d8a3b7c35907d76211d95bcd92637 /scripts/Makefile.thinlto | |
| parent | 42bc45df5905e2b7dccb72adaf7730f66cfbe03f (diff) | |
| download | linux-next-60039faf8135ff05714a2014e54597ebfe07340f.tar.gz linux-next-60039faf8135ff05714a2014e54597ebfe07340f.zip | |
virtio_balloon: prime stats vq after virtio_device_ready()
The virtio spec requires the driver not to kick the device before
DRIVER_OK is set. init_vqs() primes the stats virtqueue with a buffer
and kicks the device before virtio_device_ready() is called in
virtballoon_probe(), violating this requirement.
Further, if the device responds to the early kick by processing the
buffer before DRIVER_OK, stats_request() fires and queues
update_balloon_stats_work. Should probe then fail and free vb, the work
runs against freed memory.
To fix, move buffer setup to after DRIVER_OK. Be careful to
disable update_balloon_stats_work while this is going on,
to make sure it does not race with the setup.
setup_vqs() warns but does not fail probe or restore if
virtqueue_add_outbuf() fails; the call never actually fails in these
contexts since the queue is freshly initialized and empty.
Testing: tested that stats still work after the change.
Fixes: 9564e138b1f6 ("virtio: Add memory statistics reporting to the balloon driver (V4)")
Reported-by: Sashiko:gemini-3.1-pro-preview
Cc: David Hildenbrand <david@kernel.org>
Assisted-by: Claude:claude-sonnet-4-6
Message-ID: <e44dbd5010b20983f16ab6ec0512dba3190adcaf.1783346070.git.mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
