mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 15:05:23 +00:00
[9.20] fix: dev: Fix adbname reference
Call `dns_adbname_ref` before calling `dns_resolver_createfetch` to ensure `adbname->name` remains stable for the life of the fetch. Closes #5239 Backport of MR !10290 Merge branch 'backport-5239-fix-adb-reference-counting-9.20' into 'bind-9.20' See merge request isc-projects/bind9!10303
This commit is contained in:
@@ -3009,6 +3009,7 @@ fetch_name(dns_adbname_t *adbname, bool start_at_zone, unsigned int depth,
|
|||||||
* createfetch to find deepest cached name when we're providing
|
* createfetch to find deepest cached name when we're providing
|
||||||
* domain and nameservers.
|
* domain and nameservers.
|
||||||
*/
|
*/
|
||||||
|
dns_adbname_ref(adbname);
|
||||||
result = dns_resolver_createfetch(
|
result = dns_resolver_createfetch(
|
||||||
adb->res, adbname->name, type, name, nameservers, NULL, NULL, 0,
|
adb->res, adbname->name, type, name, nameservers, NULL, NULL, 0,
|
||||||
options, depth, qc, gqc, isc_loop(), fetch_callback, adbname,
|
options, depth, qc, gqc, isc_loop(), fetch_callback, adbname,
|
||||||
@@ -3016,11 +3017,10 @@ fetch_name(dns_adbname_t *adbname, bool start_at_zone, unsigned int depth,
|
|||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
DP(ENTER_LEVEL, "fetch_name: createfetch failed with %s",
|
DP(ENTER_LEVEL, "fetch_name: createfetch failed with %s",
|
||||||
isc_result_totext(result));
|
isc_result_totext(result));
|
||||||
|
dns_adbname_unref(adbname);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
dns_adbname_ref(adbname);
|
|
||||||
|
|
||||||
if (type == dns_rdatatype_a) {
|
if (type == dns_rdatatype_a) {
|
||||||
adbname->fetch_a = fetch;
|
adbname->fetch_a = fetch;
|
||||||
inc_resstats(adb, dns_resstatscounter_gluefetchv4);
|
inc_resstats(adb, dns_resstatscounter_gluefetchv4);
|
||||||
|
Reference in New Issue
Block a user