On Tue, Apr 8, 2025 at 12:04 AM Mike Christie
<michael.chris...@oracle.com> wrote:
>
> On 3/28/25 5:02 AM, Cindy Lu wrote:
> > +static int vhost_kthread_worker_create(struct vhost_worker *worker,
> > +                                    struct vhost_dev *dev, const char 
> > *name)
> > +{
> > +     struct task_struct *task;
> > +     u32 id;
> > +     int ret;
> > +
> > +     task = kthread_create(vhost_run_work_kthread_list, worker, "%s", 
> > name);
> > +     if (IS_ERR(task))
> > +             return PTR_ERR(task);
> > +
> > +     worker->kthread_task = task;
> > +     wake_up_process(task);
> > +     ret = xa_alloc(&dev->worker_xa, &id, worker, xa_limit_32b, 
> > GFP_KERNEL);
> > +     if (ret < 0)
> > +             goto stop_worker;
> > +
> > +     ret = vhost_attach_task_to_cgroups(worker);
> > +     if (ret)
>
> If you go to stop_worker here, it will leave the worker in the xa above. I
> think you need another goto to unwind that.
>
sure, will fix this
Thanks
Cindy
> > +             goto stop_worker;
> > +
> > +     worker->id = id;
> > +     return 0;
> > +
> > +stop_worker:
> > +     vhost_kthread_do_stop(worker);
> > +     return ret;
> > +}
> > +
>


Reply via email to