From: Arran Cudbard-Bell Date: Thu, 3 Aug 2023 16:03:55 +0000 (-0500) Subject: cache: Don't deadlock rbtree module if the cache entry isn't found and the cache... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83ce96d4c2754d2f6f790de5685cdefebf521c69;p=thirdparty%2Ffreeradius-server.git cache: Don't deadlock rbtree module if the cache entry isn't found and the cache xlat is called --- diff --git a/src/modules/rlm_cache/rlm_cache.c b/src/modules/rlm_cache/rlm_cache.c index a6661bd392f..efdf9b81790 100644 --- a/src/modules/rlm_cache/rlm_cache.c +++ b/src/modules/rlm_cache/rlm_cache.c @@ -861,11 +861,9 @@ xlat_action_t cache_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out, case RLM_MODULE_OK: /* found */ break; - case RLM_MODULE_NOTFOUND: /* not found */ - return XLAT_ACTION_FAIL; - default: talloc_free(target); + cache_release(inst, request, &handle); return XLAT_ACTION_FAIL; } diff --git a/src/tests/modules/cache_rbtree/cache-xlat.unlang b/src/tests/modules/cache_rbtree/cache-xlat.unlang index cb1aa27ebab..95b3f1c5513 100644 --- a/src/tests/modules/cache_rbtree/cache-xlat.unlang +++ b/src/tests/modules/cache_rbtree/cache-xlat.unlang @@ -21,4 +21,12 @@ if (&Tmp-String-3 != "") { test_fail } -test_pass \ No newline at end of file +# Regression test for deadlock on notfound +&Tmp-String-0 := 'testkey0' + +&Tmp-String-3 := "%(cache:request.Tmp-String-4)" + +# Would previously deadlock +&Tmp-String-4 := "%(cache:request.Tmp-String-4)" + +test_pass