Skip to content

Fix a race between process_fd and socketclose in unix socket code. [GL #744]

Witold Krecicki requested to merge 744-race-in-socket into master

In process_fd we had:

	if (SOCK_DEAD(sock)) { /* Sock is being closed, bail */
		goto unlock_fd;
	}

	isc_refcount_increment(&sock->references)

where SOCK_DEAD is check if sock->references is 0. If isc_socket_detach() happens between SOCK_DEAD() and isc_refcount_increment we will start closing the socket while still processing it. This fixes it by checking the output value of isc_refcount_increment(). Closes #744 (closed)

Merge request reports