cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Fix deadlock patch in "FLUSH" cookie and more

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 14 Jul 2014 20:39:42 +0200 (CEST)

On Sun, 13 Jul 2014, yousuke.kimoto_at_gmail.com wrote:

> This issue was reported in http://curl.haxx.se/mail/lib-2014-02/0184.html.
> Unfortunately the reporter didn't suggest his patch.
>
> This issue is caused by locking CURL_LOCK_DATA_COOKIE with specified cookie
> files. In this case, CURL_LOCK_DATA_COOKIE is locked before executing
> "FLUSH", and then Curl_cookie_loadfiles locks CURL_LOCK_DATA_COOKIE. That is
> deadlock.

Thanks for the patch. My reading of it says it is incorrect though:

  - for FLUSH you (still) take the lock before Curl_flush_cookies() is called
    and then within Curl_flush_cookies() it locks the same mutex again.

Shouldn't the patch then just have those lines removed, like this?
Received on 2014-07-14