From: Christopher Faulet Date: Fri, 14 Nov 2025 10:48:02 +0000 (+0100) Subject: BUG/MINOR: stick-tables: Fix return value for __stksess_kill() X-Git-Tag: v3.3-dev13~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=346d6c3ac78b3c05c2de1b26382a72ebef185d31;p=thirdparty%2Fhaproxy.git BUG/MINOR: stick-tables: Fix return value for __stksess_kill() The commit 9938fb9c7 ("BUG/MEDIUM: stick-tables: Fix race with peers when killing a sticky session") introduced a regression. __stksess_kill() must always return 0 if the session cannot be released. But when the ref_cnt is tested under the update lock, a success is reported if the session is still in-used. 0 must be returned in that case. This bug is harmless because callers never use the return value of __stksess_kill() or stksess_kill(). This bug must be backported as far as 3.0. --- diff --git a/src/stick_table.c b/src/stick_table.c index 240f10c75..be5db167b 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -131,6 +131,7 @@ void stksess_free(struct stktable *t, struct stksess *ts) int __stksess_kill(struct stktable *t, struct stksess *ts) { int updt_locked = 0; + int removed = 0; if (HA_ATOMIC_LOAD(&ts->ref_cnt)) return 0; @@ -153,11 +154,12 @@ int __stksess_kill(struct stktable *t, struct stksess *ts) eb32_delete(&ts->upd); ebmb_delete(&ts->key); __stksess_free(t, ts); + removed = 1; out_unlock: if (updt_locked) HA_RWLOCK_WRUNLOCK(STK_TABLE_UPDT_LOCK, &t->updt_lock); - return 1; + return removed; } /*