net: fix socket close race #9698

pull theuni wants to merge 2 commits into bitcoin:master from theuni:fix-socket-disconnect2 changing 2 files +49 −26
  1. theuni commented at 7:58 PM on February 6, 2017: member

    This fixes an observed crash as a result of trying to use hSocket after it's been set to -1.

    The first commit just rearranges things so that we can lock in a consistent order (avoiding a possible inversion involving cs_vSend and cs_hSocket).

    The second adds a lock everywhere hSocket is touched, and checks that it's still valid before using it.

  2. net: rearrange so that socket accesses can be grouped together 45e2e08561
  3. net: add a lock around hSocket 9a0b784dea
  4. TheBlueMatt commented at 8:16 PM on February 6, 2017: member

    ACK 9a0b784deaab6b9fffcab227d928987b981d0572, been running the same with a pile of other fixes in helgrind for a bit and it looks OK.

  5. fanquake added the label P2P on Feb 7, 2017
  6. laanwj added this to the milestone 0.14.0 on Feb 7, 2017
  7. gmaxwell commented at 4:15 AM on February 8, 2017: contributor

    ACK

  8. morcos commented at 8:29 PM on February 9, 2017: member

    utACK 9a0b784

  9. laanwj merged this on Feb 10, 2017
  10. laanwj closed this on Feb 10, 2017

  11. laanwj referenced this in commit 2447c1024e on Feb 10, 2017
  12. codablock referenced this in commit a6cde19149 on Jan 19, 2018
  13. codablock referenced this in commit 3b543952d4 on Jan 23, 2018
  14. andvgal referenced this in commit 444c0a3444 on Jan 6, 2019
  15. CryptoCentric referenced this in commit c59372a71a on Feb 27, 2019
  16. random-zebra referenced this in commit cbd9271afb on Sep 7, 2020
  17. LarryRuane referenced this in commit 8fe399100f on Feb 24, 2021
  18. LarryRuane referenced this in commit 23941d997a on Feb 24, 2021
  19. LarryRuane referenced this in commit 8a26f4b800 on Apr 1, 2021
  20. LarryRuane referenced this in commit 9825103a10 on Apr 1, 2021
  21. zkbot referenced this in commit 1b5f17c900 on Apr 1, 2021
  22. zkbot referenced this in commit 80e66e7daa on Apr 2, 2021
  23. DrahtBot locked this on Sep 8, 2021
Labels

Milestone
0.14.0


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-18 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me