[PATCH] Avoid a pipe read in aio result scheduling

Volker Lendecke vl at samba.org
Tue Aug 23 06:11:41 UTC 2016


On Mon, Aug 22, 2016 at 08:25:03PM -0700, Jeremy Allison wrote:
> static int pthreadpool_tevent_job_destructor(struct pthreadpool_tevent_job_state *state)
> {
>         if (state->pool == NULL) {
>                 return 0;
>         }
> 
>         /*
>          * We should never be called with state->req != NULL,
>          * state->pool must be cleared before the 2nd talloc_free().
>          */
>         if (state->req != NULL) {
>                 abort();
>         }
> 
>         /*
>          * We need to reparent to a long term context.
>          */
>         (void)talloc_reparent(state->req, state->pool, state);
>         state->req = NULL;
>         return -1;
> }
> 
> is doing :-(.
> 
> I get the 'normal' case where pthreadpool_tevent_job_done()
> is called, so state->pool = NULL and all is well. Can you
> explain the failure mode you're explicity guarding against
> here with (state->req != NULL) ?

This is metze's piece :-)

So, the point is that we want to protect against someone doing a
talloc_free(req) while the job is running. See the comment in
pthreadpool_tevent_job_done().

Volker



More information about the samba-technical mailing list