]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/session2_tasklist_del(): be more defensive
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 24 Apr 2025 08:10:44 +0000 (10:10 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 24 Apr 2025 08:49:52 +0000 (10:49 +0200)
I don't expect we still have a bug here, but even so -
if this assertion fails, I don't think we need to force a crash.
A recoverable assertion seems a better choice here.

daemon/session2.c

index 22c6674a946d0c92cb0ceb17f13f35bcfa054023..2a1fe68812c0c9b2c851f7ca027ef9c2abd762f1 100644 (file)
@@ -1046,7 +1046,8 @@ int session2_tasklist_del(struct session2 *session, struct qr_task *task)
        }
        int ret = trie_del(t, key, key_len, &val);
        if (ret == KNOT_EOK) {
-               kr_require(val == task);
+               if (kr_fails_assert(val == task)) // internal inconsistency in tasklist
+                       return kr_error(EINVAL);
                worker_task_unref(val);
        }
        return ret;