Module Name:    src
Committed By:   martin
Date:           Sun Dec 15 14:32:47 UTC 2024

Modified Files:
        src/sys/net [netbsd-10]: if_wg.c

Log Message:
Pull up following revision(s) (requested by alnsn in ticket #1022):

        sys/net/if_wg.c: revision 1.133

wg(4): Avoid spurious kassert for harmless race in session retry.

If we have already transitioned away from INIT_ACTIVE by the time the
retry timer has fired, the handshake start time may have been zeroed,
but that's harmless.  So don't kassert about it until after we've
verified we're still in INIT_ACTIVE state.

PR kern/58859: KASSERT in wg_task_retry_handshake


To generate a diff of this commit:
cvs rdiff -u -r1.71.2.4 -r1.71.2.5 src/sys/net/if_wg.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_wg.c
diff -u src/sys/net/if_wg.c:1.71.2.4 src/sys/net/if_wg.c:1.71.2.5
--- src/sys/net/if_wg.c:1.71.2.4	Wed Oct  9 11:15:39 2024
+++ src/sys/net/if_wg.c	Sun Dec 15 14:32:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wg.c,v 1.71.2.4 2024/10/09 11:15:39 martin Exp $	*/
+/*	$NetBSD: if_wg.c,v 1.71.2.5 2024/12/15 14:32:46 martin Exp $	*/
 
 /*
  * Copyright (C) Ryota Ozaki <ozaki.ry...@gmail.com>
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.71.2.4 2024/10/09 11:15:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.71.2.5 2024/12/15 14:32:46 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq_enabled.h"
@@ -3386,12 +3386,13 @@ wg_task_retry_handshake(struct wg_softc 
 	WG_TRACE("WGP_TASK_RETRY_HANDSHAKE");
 
 	KASSERT(mutex_owned(wgp->wgp_lock));
-	KASSERT(wgp->wgp_handshake_start_time != 0);
 
 	wgs = wgp->wgp_session_unstable;
 	if (wgs->wgs_state != WGS_STATE_INIT_ACTIVE)
 		return;
 
+	KASSERT(wgp->wgp_handshake_start_time != 0);
+
 	/*
 	 * XXX no real need to assign a new index here, but we do need
 	 * to transition to UNKNOWN temporarily

Reply via email to