mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
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: 7d9896e9f6 ("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>
This commit is contained in:
committed by
Michael S. Tsirkin
parent
b41ca62c00
commit
f3f64c2eaf
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user