mirror of
https://github.com/isc-projects/bind9.git
synced 2026-02-27 03:51:16 -05:00
3708. [bug] Address a portentry locking issue in dispatch.c.
[RT #35128]
(cherry picked from commit 702958d202)
This commit is contained in:
parent
9f137000c4
commit
0c3a129e61
2 changed files with 14 additions and 6 deletions
3
CHANGES
3
CHANGES
|
|
@ -1,3 +1,6 @@
|
|||
3708. [bug] Address a portentry locking issue in dispatch.c.
|
||||
[RT #35128]
|
||||
|
||||
3707. [bug] irs_resconf_load now returns ISC_R_FILENOTFOUND
|
||||
on a missing resolv.conf file and initializes the
|
||||
structure as if it had been configured with:
|
||||
|
|
|
|||
|
|
@ -778,6 +778,7 @@ port_search(dns_dispatch_t *disp, in_port_t port) {
|
|||
static dispportentry_t *
|
||||
new_portentry(dns_dispatch_t *disp, in_port_t port) {
|
||||
dispportentry_t *portentry;
|
||||
dns_qid_t *qid;
|
||||
|
||||
REQUIRE(disp->port_table != NULL);
|
||||
|
||||
|
|
@ -786,10 +787,13 @@ new_portentry(dns_dispatch_t *disp, in_port_t port) {
|
|||
return (portentry);
|
||||
|
||||
portentry->port = port;
|
||||
portentry->refs = 0;
|
||||
portentry->refs = 1;
|
||||
ISC_LINK_INIT(portentry, link);
|
||||
qid = DNS_QID(disp);
|
||||
LOCK(&qid->lock);
|
||||
ISC_LIST_APPEND(disp->port_table[port % DNS_DISPATCH_PORTTABLESIZE],
|
||||
portentry, link);
|
||||
UNLOCK(&qid->lock);
|
||||
|
||||
return (portentry);
|
||||
}
|
||||
|
|
@ -800,7 +804,6 @@ new_portentry(dns_dispatch_t *disp, in_port_t port) {
|
|||
static void
|
||||
deref_portentry(dns_dispatch_t *disp, dispportentry_t **portentryp) {
|
||||
dispportentry_t *portentry = *portentryp;
|
||||
isc_boolean_t unlink = ISC_FALSE;
|
||||
dns_qid_t *qid;
|
||||
|
||||
REQUIRE(disp->port_table != NULL);
|
||||
|
|
@ -809,15 +812,14 @@ deref_portentry(dns_dispatch_t *disp, dispportentry_t **portentryp) {
|
|||
qid = DNS_QID(disp);
|
||||
LOCK(&qid->lock);
|
||||
portentry->refs--;
|
||||
unlink = ISC_TF(portentry->refs == 0);
|
||||
UNLOCK(&qid->lock);
|
||||
|
||||
if (unlink) {
|
||||
if (portentry->refs == 0) {
|
||||
ISC_LIST_UNLINK(disp->port_table[portentry->port %
|
||||
DNS_DISPATCH_PORTTABLESIZE],
|
||||
portentry, link);
|
||||
isc_mempool_put(disp->portpool, portentry);
|
||||
}
|
||||
UNLOCK(&qid->lock);
|
||||
|
||||
*portentryp = NULL;
|
||||
}
|
||||
|
|
@ -939,8 +941,11 @@ get_dispsocket(dns_dispatch_t *disp, isc_sockaddr_t *dest,
|
|||
result = ISC_R_NOMEMORY;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
LOCK(&qid->lock);
|
||||
portentry->refs++;
|
||||
UNLOCK(&qid->lock);
|
||||
}
|
||||
portentry->refs++;
|
||||
break;
|
||||
} else if (result == ISC_R_NOPERM) {
|
||||
char buf[ISC_SOCKADDR_FORMATSIZE];
|
||||
|
|
|
|||
Loading…
Reference in a new issue