From b46108b4282582db3e5c91cebbef8f88876729a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 2 Oct 2024 08:37:48 +0200 Subject: [PATCH] Skip TCP dispatch responses that are not ours When matching the TCP dispatch responses, we should skip the responses that do not belong to our TCP connection. This can happen with faulty upstream server that sends invalid QID back to us. (cherry picked from commit 4ef316e21ef6313fb522f6bf17576cb7a9a7b085) --- lib/dns/dispatch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c index 9a9d5d72df..81a0c0412b 100644 --- a/lib/dns/dispatch.c +++ b/lib/dns/dispatch.c @@ -694,7 +694,9 @@ tcp_recv_success(dns_dispatch_t *disp, isc_region_t *region, dns_dispentry_t *resp = cds_lfht_entry(cds_lfht_iter_get_node(&iter), dns_dispentry_t, ht_node); - if (resp != NULL) { + + /* Skip responses that are not ours */ + if (resp != NULL && resp->disp == disp) { if (!resp->reading) { /* * We already got a message for this QID and weren't