Skip to content

Commit f3f64c2

Browse files
mikechristiemstsirkin
authored andcommitted
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: 7d9896e ("vhost: Reintroduce kthread API and add mode selection") Signed-off-by: Mike Christie <michael.christie@oracle.com> Acked-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20251101194358.13605-1-michael.christie@oracle.com>
1 parent b41ca62 commit f3f64c2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/vhost/vhost.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,11 +804,13 @@ static int vhost_kthread_worker_create(struct vhost_worker *worker,
804804

805805
ret = vhost_attach_task_to_cgroups(worker);
806806
if (ret)
807-
goto stop_worker;
807+
goto free_id;
808808

809809
worker->id = id;
810810
return 0;
811811

812+
free_id:
813+
xa_erase(&dev->worker_xa, id);
812814
stop_worker:
813815
vhost_kthread_do_stop(worker);
814816
return ret;

0 commit comments

Comments
 (0)