Skip to content
  • Rasmus Villemoes's avatar
    kernel/async.c: revert "async: simplify lowest_in_progress()" · c832448d
    Rasmus Villemoes authored
    commit 4f7e988e upstream.
    
    This reverts commit 92266d6e ("async: simplify lowest_in_progress()")
    which was simply wrong: In the case where domain is NULL, we now use the
    wrong offsetof() in the list_first_entry macro, so we don't actually
    fetch the ->cookie value, but rather the eight bytes located
    sizeof(struct list_head) further into the struct async_entry.
    
    On 64 bit, that's the data member, while on 32 bit, that's a u64 built
    from func and data in some order.
    
    I think the bug happens to be harmless in practice: It obviously only
    affects callers which pass a NULL domain, and AFAICT the only such
    caller is
    
      async_synchronize_full() ->
      async_synchronize_full_domain(NULL) ->
      async_synchronize_cookie_domain(ASYNC_COOKIE_MAX, NULL)
    
    and the ASYNC_COOKIE_MAX means that in practice we end up waiting for
    the async_global_pending list to be empty - but it would break if
    somebody happened to pass (void*)-1 as ...
    c832448d