git: 6b0060daf50e - stable/15 - ntsync(4): do not double-free the alert event when a dup was detected for WAIT_ALL

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 11 Sep 2026 00:25:32 UTC
The branch stable/15 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=6b0060daf50e93f68de435dc94a21322056cd29c

commit 6b0060daf50e93f68de435dc94a21322056cd29c
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-09-04 14:40:50 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-09-11 00:25:05 +0000

    ntsync(4): do not double-free the alert event when a dup was detected for WAIT_ALL
    
    (cherry picked from commit c0c7b56d3039a75a01315d610e386a5e9eda704c)
---
 sys/dev/ntsync/ntsync.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/dev/ntsync/ntsync.c b/sys/dev/ntsync/ntsync.c
index 2dec2f68aa80..c1c3ab6a3d6c 100644
--- a/sys/dev/ntsync/ntsync.c
+++ b/sys/dev/ntsync/ntsync.c
@@ -1263,6 +1263,8 @@ ntsync_wait_state_get(struct ntsync_wait_args *nwa, u_long cmd,
 			for (j = i + 1; j < state->obj_count; j++) {
 				if (obj == state->objs[j]) {
 					i = state->obj_count;
+					if (state->alert_event != NULL)
+						i--;
 					error = EINVAL;
 					goto error_out;
 				}