All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qmp: Check vhost protocol features for NULL prior to dumping
@ 2026-03-19  8:50 Nikolay Kuratov
  2026-03-19 13:59 ` Markus Armbruster
  0 siblings, 1 reply; 3+ messages in thread
From: Nikolay Kuratov @ 2026-03-19  8:50 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel, qemu-stable

vhost_dev->protocol_features field can be legitimately set to NULL
as apparently it's vhost-user only field. At least I was able to get
NULL deref with a vhost-net VM.

Without that check querying vhost-net device:
info virtio-status /machine/peripheral-anon/device[0]/virtio-backend
will lead to SIGSEGV.

Fixes: 8a8287981d1169f534894d983ecfd3b70b71918b ("hmp: add virtio commands")
Cc: qemu-stable@nongnu.org
Signed-off-by: Nikolay Kuratov <kniv@yandex-team.ru>
---
 hw/virtio/virtio-hmp-cmds.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/virtio/virtio-hmp-cmds.c b/hw/virtio/virtio-hmp-cmds.c
index 1daae482d3..b9980197ef 100644
--- a/hw/virtio/virtio-hmp-cmds.c
+++ b/hw/virtio/virtio-hmp-cmds.c
@@ -15,6 +15,9 @@
 static void hmp_virtio_dump_protocols(Monitor *mon,
                                       VhostDeviceProtocols *pcol)
 {
+    if (pcol == NULL) {
+        return;
+    }
     strList *pcol_list = pcol->protocols;
     while (pcol_list) {
         monitor_printf(mon, "\t%s", pcol_list->value);
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-19 15:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19  8:50 [PATCH] qmp: Check vhost protocol features for NULL prior to dumping Nikolay Kuratov
2026-03-19 13:59 ` Markus Armbruster
2026-03-19 15:13   ` Nikolay Kuratov

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.