diff options
| author | Mike Christie <michael.christie@oracle.com> | 2025-11-01 14:43:58 -0500 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2025-11-27 02:03:06 -0500 |
| commit | f3f64c2eaffbc3169bbe1e5d1e897e6dacc839d1 (patch) | |
| tree | c3b13528268e05aec55891f9a70f0756870a910c | |
| parent | b41ca62c0019de1321d75f2b2f274a28784a41ed (diff) | |
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: 7d9896e9f6d0 ("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>
| -rw-r--r-- | drivers/vhost/vhost.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 8570fdf2e14a..e6df5bb4932b 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -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; |
