Skip to content
  • Hanna Reitz's avatar
    bfb23b48
    curl: Handle success in multi_check_completion · bfb23b48
    Hanna Reitz authored
    
    
    Background: As of cURL 7.59.0, it verifies that several functions are
    not called from within a callback.  Among these functions is
    curl_multi_add_handle().
    
    curl_read_cb() is a callback from cURL and not a coroutine.  Waking up
    acb->co will lead to entering it then and there, which means the current
    request will settle and the caller (if it runs in the same coroutine)
    may then issue the next request.  In such a case, we will enter
    curl_setup_preadv() effectively from within curl_read_cb().
    
    Calling curl_multi_add_handle() will then fail and the new request will
    not be processed.
    
    Fix this by not letting curl_read_cb() wake up acb->co.  Instead, leave
    the whole business of settling the AIOCB objects to
    curl_multi_check_completion() (which is called from our timer callback
    and our FD handler, so not from any cURL callbacks).
    
    Reported-by: default avatarNatalie Gavrielov <ngavrilo@redhat.com>
    Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1740193
    
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    Message-id: 20190910124136.10565-7-mreitz@redhat.com
    Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
    Reviewed-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    bfb23b48
    curl: Handle success in multi_check_completion
    Hanna Reitz authored
    
    
    Background: As of cURL 7.59.0, it verifies that several functions are
    not called from within a callback.  Among these functions is
    curl_multi_add_handle().
    
    curl_read_cb() is a callback from cURL and not a coroutine.  Waking up
    acb->co will lead to entering it then and there, which means the current
    request will settle and the caller (if it runs in the same coroutine)
    may then issue the next request.  In such a case, we will enter
    curl_setup_preadv() effectively from within curl_read_cb().
    
    Calling curl_multi_add_handle() will then fail and the new request will
    not be processed.
    
    Fix this by not letting curl_read_cb() wake up acb->co.  Instead, leave
    the whole business of settling the AIOCB objects to
    curl_multi_check_completion() (which is called from our timer callback
    and our FD handler, so not from any cURL callbacks).
    
    Reported-by: default avatarNatalie Gavrielov <ngavrilo@redhat.com>
    Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1740193
    
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    Message-id: 20190910124136.10565-7-mreitz@redhat.com
    Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
    Reviewed-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
Loading