From b693db17a84cdf20bf9312d37a65291490a754e3 Mon Sep 17 00:00:00 2001 From: Neil Kettle Date: Tue, 31 Mar 2026 11:34:32 +0200 Subject: [PATCH 1/2] Fix logic in load comparison for node selection fix tautological contradiction, 'A^!A' Signed-off-by: Neil Kettle --- policy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/policy.c b/policy.c index 8c5d244..c3d16ec 100644 --- a/policy.c +++ b/policy.c @@ -108,7 +108,7 @@ is_better_candidate(struct sta_info *si_cur, struct sta_info *si_new) reasons |= (1 << UEV_SELECT_REASON_SIGNAL); if (has_better_load(current_node, new_node) && - !has_better_load(current_node, new_node)) + !has_better_load(new_node, current_node)) reasons |= (1 << UEV_SELECT_REASON_LOAD); return reasons; From d729d8c834fa669c46e23d3df0ae3c8203491826 Mon Sep 17 00:00:00 2001 From: Neil Kettle Date: Tue, 31 Mar 2026 11:36:27 +0200 Subject: [PATCH 2/2] Handle NULL sta_addr by freeing query memory Free the query memory if sta_addr is NULL before returning. Signed-off-by: Neil Kettle --- local_node.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/local_node.c b/local_node.c index e74d945..e2a8048 100644 --- a/local_node.c +++ b/local_node.c @@ -132,8 +132,10 @@ usteer_handle_bss_tm_query(struct usteer_local_node *ln, struct blob_attr *msg) query->dialog_token = blobmsg_get_u8(tb[BSS_TM_QUERY_DIALOG_TOKEN]); sta_addr = (uint8_t *) ether_aton(blobmsg_get_string(tb[BSS_TM_QUERY_ADDRESS])); - if (!sta_addr) + if (!sta_addr) { + free(query); return 0; + } memcpy(query->sta_addr, sta_addr, 6);