diff options
author | Jay Satiro <raysatiro@yahoo.com> | 2019-02-11 23:00:00 -0500 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2019-02-14 17:42:43 +0100 |
commit | 4015fae044ce52a639c9358e22a9e948f287c89f (patch) | |
tree | 572a573d8ddd5364e49f095fba47e204a5846ecd /lib/nonblock.h | |
parent | 49d73d40f6118cbe10e60ff0351fad30bf4cde2b (diff) |
connection_check: restore original conn->data after the check
- Save the original conn->data before it's changed to the specified
data transfer for the connection check and then restore it afterwards.
This is a follow-up to 38d8e1b 2019-02-11.
History:
It was discovered a month ago that before checking whether to extract a
dead connection that that connection should be associated with a "live"
transfer for the check (ie original conn->data ignored and set to the
passed in data). A fix was landed in 54b201b which did that and also
cleared conn->data after the check. The original conn->data was not
restored, so presumably it was thought that a valid conn->data was no
longer needed.
Several days later it was discovered that a valid conn->data was needed
after the check and follow-up fix was landed in bbae24c which partially
reverted the original fix and attempted to limit the scope of when
conn->data was changed to only when pruning dead connections. In that
case conn->data was not cleared and the original conn->data not
restored.
A month later it was discovered that the original fix was somewhat
correct; a "live" transfer is needed for the check in all cases
because original conn->data could be null which could cause a bad deref
at arbitrary points in the check. A fix was landed in 38d8e1b which
expanded the scope to all cases. conn->data was not cleared and the
original conn->data not restored.
A day later it was discovered that not restoring the original conn->data
may lead to busy loops in applications that use the event interface, and
given this observation it's a pretty safe assumption that there is some
code path that still needs the original conn->data. This commit is the
follow-up fix for that, it restores the original conn->data after the
connection check.
Assisted-by: tholin@users.noreply.github.com
Reported-by: tholin@users.noreply.github.com
Fixes https://github.com/curl/curl/issues/3542
Closes #3559
Diffstat (limited to 'lib/nonblock.h')
0 files changed, 0 insertions, 0 deletions