Description: Fix slurmctld SIGSEGV in assoc_mgr_info_get_pack_msg() on NULL lists
 assoc_mgr_info_get_pack_msg() unconditionally iterates the association
 and QOS caches when the corresponding request flag is set, but those
 global lists are NULL until slurmdbd data has been loaded (e.g., with
 accounting_storage/none, or before slurmdbd is connected). In a release
 build the xassert() in list_iterator_create() is compiled out, so a NULL
 list leads to a write-lock on address 0x30 and a segfault. Any client
 issuing "scontrol show assoc_mgr" can crash the controller.
 .
 The USERS section already guards against a NULL list; this extends the
 same guard to the ASSOC and QOS sections, so an empty section is packed
 instead of crashing.
Author: Shengqi Chen <harry@debian.org>
Origin: other
Bug-Debian: https://bugs.debian.org/1144337
Forwarded: https://support.schedmd.com/show_bug.cgi?id=25708
Last-Update: 2026-08-14

--- slurm-wlm-26.05.5.orig/src/common/assoc_mgr.c
+++ slurm-wlm-26.05.5/src/common/assoc_mgr.c
@@ -3749,7 +3749,7 @@ extern buf_t *assoc_mgr_info_get_pack_ms
 
 	assoc_mgr_lock(&locks);
 
-	if (!(flags & ASSOC_MGR_INFO_FLAG_ASSOC))
+        if (!(flags & ASSOC_MGR_INFO_FLAG_ASSOC) || !assoc_mgr_assoc_list)
 		goto no_assocs;
 
 	itr = list_iterator_create(assoc_mgr_assoc_list);
@@ -3828,7 +3828,7 @@ no_assocs:
 	list_iterator_destroy(itr);
 	list_flush(ret_list);
 
-	if (!(flags & ASSOC_MGR_INFO_FLAG_QOS)) {
+	if (!(flags & ASSOC_MGR_INFO_FLAG_QOS) || !assoc_mgr_qos_list) {
 		tmp_list = ret_list;
 		goto no_qos;
 	}
