From 7bdcf8fc708c04ed9275bc5dfc301323a31d1e85 Mon Sep 17 00:00:00 2001 From: Hoss Seyedmehdi Date: Mon, 1 Jun 2026 21:48:17 -0700 Subject: [PATCH] fix: guard NULL part_ptr and license_list in expansion path in slurmctld node_mgr_make_node_blocked dereferences job_ptr->part_ptr when calling topology_g_whole_topo, but the IS_JOB_WHOLE_TOPO macro can return true via (details->whole_node & WHOLE_TOPO) when part_ptr is still NULL. This segfaults slurmctld. Add an early return when part_ptr is NULL. _valid_license_job_expansion passes license_list directly to list_find_first_ro, which xasserts on NULL. Debug builds abort and production builds (where xassert is compiled out) dereference NULL inside the lock path. Check license_list before each call. --- src/slurmctld/job_mgr.c | 6 ++++-- src/slurmctld/node_mgr.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index fdf88a86d0a..abe7bbede22 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -12225,8 +12225,10 @@ static bool _valid_license_job_expansion(job_record_t *job_ptr1, xstrchr(job_ptr2->licenses, '|')) return false; - if (list_find_first_ro(job_ptr1->license_list, _find_hres, NULL) || - list_find_first_ro(job_ptr2->license_list, _find_hres, NULL)) + if ((job_ptr1->license_list && + list_find_first_ro(job_ptr1->license_list, _find_hres, NULL)) || + (job_ptr2->license_list && + list_find_first_ro(job_ptr2->license_list, _find_hres, NULL))) return false; return true; diff --git a/src/slurmctld/node_mgr.c b/src/slurmctld/node_mgr.c index 3cfb22aff2b..9d03d80ce30 100644 --- a/src/slurmctld/node_mgr.c +++ b/src/slurmctld/node_mgr.c @@ -4370,7 +4370,7 @@ extern void node_mgr_make_node_blocked(job_record_t *job_ptr, bool set) if (!IS_JOB_WHOLE_TOPO(job_ptr)) return; - if (!job_ptr->job_resrcs || !job_ptr->job_resrcs->node_bitmap) + if (!job_ptr->job_resrcs || !job_ptr->job_resrcs->node_bitmap || !job_ptr->part_ptr) return; tmp_bitmap = bit_copy(job_ptr->job_resrcs->node_bitmap);