Branch: refs/heads/master
  Home:   https://github.com/OpenSIPS/opensips
  Commit: ef3518bf2c4035821fab1c87a621182a623c3493
      
https://github.com/OpenSIPS/opensips/commit/ef3518bf2c4035821fab1c87a621182a623c3493
  Author: Bogdan-Andrei Iancu <bog...@opensips.org>
  Date:   2021-04-20 (Tue, 20 Apr 2021)

  Changed paths:
    M net/net_tcp.c

  Log Message:
  -----------
  Fix race condition between accept and write on TCP conn

Upon accepting a new TCP conn, the TCP Main is adding the conn into the hash, 
but the conn is initialized by the protocol just after being passed to the TCP 
Worker. So, for a short time (while the conn is passed from TCP Main to TCP 
Worker), the conn is not properly initialized, so not safe to use. And here we 
have the race condition, as the conn, being already in the tcp hash, it is 
foundable by any other process trying to do a write op. So, a process may end 
up trying to do a write on an not fully init tcp conn -> crash :(
The fix is to avoid "finding" in hash the uninit conns.

Closes #2258



_______________________________________________
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel

Reply via email to