2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 22:45:39 +00:00

Address potential double unlock in process_fd

This commit is contained in:
Mark Andrews
2020-07-07 11:11:15 +10:00
parent d97710acdc
commit cc0089c66b

View File

@@ -3072,7 +3072,6 @@ finish:
unwatch_fd(&sock->manager->threads[sock->threadid], sock->fd, unwatch_fd(&sock->manager->threads[sock->threadid], sock->fd,
SELECT_POKE_READ); SELECT_POKE_READ);
} }
UNLOCK(&sock->lock);
} }
static void static void
@@ -3112,7 +3111,6 @@ finish:
unwatch_fd(&sock->manager->threads[sock->threadid], sock->fd, unwatch_fd(&sock->manager->threads[sock->threadid], sock->fd,
SELECT_POKE_WRITE); SELECT_POKE_WRITE);
} }
UNLOCK(&sock->lock);
} }
/* /*
@@ -3158,14 +3156,6 @@ process_fd(isc__socketthread_t *thread, int fd, bool readable, bool writeable) {
} }
REQUIRE(readable || writeable); REQUIRE(readable || writeable);
if (readable) {
if (sock->listener) {
internal_accept(sock);
} else {
internal_recv(sock);
}
}
if (writeable) { if (writeable) {
if (sock->connecting) { if (sock->connecting) {
internal_connect(sock); internal_connect(sock);
@@ -3174,7 +3164,17 @@ process_fd(isc__socketthread_t *thread, int fd, bool readable, bool writeable) {
} }
} }
/* sock->lock is unlocked in internal_* function */ if (readable) {
if (sock->listener) {
internal_accept(sock); /* unlocks sock */
} else {
internal_recv(sock);
UNLOCK(&sock->lock);
}
} else {
UNLOCK(&sock->lock);
}
UNLOCK(&thread->fdlock[lockid]); UNLOCK(&thread->fdlock[lockid]);
/* /*
@@ -4950,7 +4950,6 @@ internal_connect(isc__socket_t *sock) {
finish: finish:
unwatch_fd(&sock->manager->threads[sock->threadid], sock->fd, unwatch_fd(&sock->manager->threads[sock->threadid], sock->fd,
SELECT_POKE_CONNECT); SELECT_POKE_CONNECT);
UNLOCK(&sock->lock);
} }
isc_result_t isc_result_t