From: Victor Julien Date: Tue, 14 May 2024 04:46:25 +0000 (+0200) Subject: hostbits: release use_cnt for unix (add|remove)-hostbit X-Git-Tag: suricata-7.0.6~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a74eaa48a8ea43b49421fb0e5cea3ccc26bf27a;p=thirdparty%2Fsuricata.git hostbits: release use_cnt for unix (add|remove)-hostbit Commands would leave use_cnt incremented, never decrementing them. This would lead to a asserting triggering at shutdown. Bug: #7020. (cherry picked from commit d02c57bd1f21873d8a2a78e14a903f2e6c9771c2) --- diff --git a/src/runmode-unix-socket.c b/src/runmode-unix-socket.c index 8b269900e7..20b25f25f9 100644 --- a/src/runmode-unix-socket.c +++ b/src/runmode-unix-socket.c @@ -1280,7 +1280,7 @@ TmEcode UnixSocketHostbitAdd(json_t *cmd, json_t* answer, void *data_usused) Host *host = HostGetHostFromHash(&a); if (host) { HostBitSet(host, idx, SCTIME_SECS(current_time) + expire); - HostUnlock(host); + HostRelease(host); json_object_set_new(answer, "message", json_string("hostbit added")); return TM_ECODE_OK; @@ -1349,7 +1349,7 @@ TmEcode UnixSocketHostbitRemove(json_t *cmd, json_t* answer, void *data_unused) Host *host = HostLookupHostFromHash(&a); if (host) { HostBitUnset(host, idx); - HostUnlock(host); + HostRelease(host); json_object_set_new(answer, "message", json_string("hostbit removed")); return TM_ECODE_OK; } else { @@ -1426,7 +1426,7 @@ TmEcode UnixSocketHostbitList(json_t *cmd, json_t* answer, void *data_unused) bits[use].expire = iter->expire; use++; } - HostUnlock(host); + HostRelease(host); json_t *jdata = json_object(); json_t *jarray = json_array();