[PATCH v1 1/1] binder: fix freeze race

Li Li dualli at chromium.org
Fri Sep 10 07:04:35 UTC 2021


On Thu, Sep 9, 2021 at 11:03 PM Dan Carpenter <dan.carpenter at oracle.com> wrote:
>
> On Thu, Sep 09, 2021 at 04:21:41PM -0700, Li Li wrote:
> > @@ -4648,6 +4647,22 @@ static int binder_ioctl_get_node_debug_info(struct binder_proc *proc,
> >       return 0;
> >  }
> >
> > +static int binder_txns_pending(struct binder_proc *proc)
> > +{
> > +     struct rb_node *n;
> > +     struct binder_thread *thread;
> > +
> > +     if (proc->outstanding_txns > 0)
> > +             return 1;
>
> Make this function bool.

Will include the change (as well as the extra ->outstanding_txns
check) in the next revision.
>
> > +
> > +     for (n = rb_first(&proc->threads); n; n = rb_next(n)) {
> > +             thread = rb_entry(n, struct binder_thread, rb_node);
> > +             if (thread->transaction_stack)
> > +                     return 1;
> > +     }
> > +     return 0;
> > +}
> > +
> >  static int binder_ioctl_freeze(struct binder_freeze_info *info,
> >                              struct binder_proc *target_proc)
> >  {
> > @@ -4682,6 +4697,14 @@ static int binder_ioctl_freeze(struct binder_freeze_info *info,
> >       if (!ret && target_proc->outstanding_txns)
> >               ret = -EAGAIN;
>
> These two lines can be deleted now because binder_txns_pending() checks
> ->outstanding_txns.
>

Thanks,
Li


More information about the devel mailing list