Commit f3f64c2e authored by Mike Christie's avatar Mike Christie Committed by Michael S. Tsirkin
Browse files

vhost: Fix kthread worker cgroup failure handling



If we fail to attach to a cgroup we are leaking the id. This adds
a new goto to free the id.

Fixes: 7d9896e9 ("vhost: Reintroduce kthread API and add mode selection")
Signed-off-by: default avatarMike Christie <michael.christie@oracle.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Message-Id: <20251101194358.13605-1-michael.christie@oracle.com>
parent b41ca62c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -804,11 +804,13 @@ static int vhost_kthread_worker_create(struct vhost_worker *worker,

	ret = vhost_attach_task_to_cgroups(worker);
	if (ret)
		goto stop_worker;
		goto free_id;

	worker->id = id;
	return 0;

free_id:
	xa_erase(&dev->worker_xa, id);
stop_worker:
	vhost_kthread_do_stop(worker);
	return ret;