From 509f6bd229e94fc39506e01be692c4aa22338b49 Mon Sep 17 00:00:00 2001 From: Linfeng Sun Date: Sun, 11 Oct 2026 15:33:30 +0800 Subject: [PATCH] vhost: reject backend enable without a kick file Enabling a backend without VHOST_SET_VRING_KICK dereferences a NULL vq->kick in vhost_poll_start(). Reject the request with -EINVAL. Fixes: 264ee5aa81ec ("tools/virtio: Add --reset") Assisted-by: OpenAI-Codex:GPT-5.6 Signed-off-by: Linfeng Sun Signed-off-by: Michael S. Tsirkin Message-ID: <20261011-fix-null-pointer-in-vhost_test_set_backend-v1-1-60b2f12d64c6@gmail.com> --- drivers/vhost/test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c index 84ed9ea81219..65dc8c71336d 100644 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c @@ -287,6 +287,10 @@ static long vhost_test_set_backend(struct vhost_test *n, unsigned index, int fd) r = -EFAULT; goto err_vq; } + if (enable && !vq->kick) { + r = -EINVAL; + goto err_vq; + } if (!enable) { vhost_poll_stop(&vq->poll); backend = vhost_vq_get_backend(vq);