Skip to content

fix: dev: Fix a data race between dns_zone_getxfr() and dns_xfrin_create()

Arаm Sаrgsyаn requested to merge 5011-dns_zone_getxfr-race-fix into main

There is a data race between the statistics channel, which uses dns_zone_getxfr() to get a reference to zone->xfr, and the creation of zone->xfr, because the latter happens outside of a zone lock.

Split the dns_xfrin_create() function into two parts to separate the zone transfer starting part from the zone transfer object creation part. This allows us to attach the new object to a local variable first, then attach it to zone->xfr under a lock, and only then start the transfer.

Closes #5011 (closed)

Edited by Mark Andrews

Merge request reports