]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
cache: Don't deadlock rbtree module if the cache entry isn't found and the cache...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 3 Aug 2023 16:03:55 +0000 (11:03 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 3 Aug 2023 16:04:09 +0000 (11:04 -0500)
src/modules/rlm_cache/rlm_cache.c
src/tests/modules/cache_rbtree/cache-xlat.unlang

index a6661bd392fb398645b4a8b7a8b7752049bfd78d..efdf9b81790f60975e97feb4092e8bc83659a6dc 100644 (file)
@@ -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;
        }
 
index cb1aa27ebab768d05e41ed193c6af92a4cdfca41..95b3f1c55135119039e24e801325807a04a976c4 100644 (file)
@@ -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