[PATCH v2 4/4] handshake: check expiration propery in set_pmksa()

James Prestwood <[email protected]> Mon, 9 Mar 2026 08:36:29 -0700
Newsgroups dev.linux.lists.iwd
Message-ID <[email protected]>
The existing check was only looking at s->expiration and if it was
zero or non-zero. If a PMKSA exists for a BSS the expiration will
be non-zero, but that shouldn't preclude us from setting that into
the handshake.

Instead check if the PMKSA is actually expired, and only then
return false.
---
 src/handshake.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/handshake.c b/src/handshake.c
index ef1a8220..5e864af3 100644
--- a/src/handshake.c
+++ b/src/handshake.c
@@ -1227,8 +1227,9 @@ done:
 bool handshake_state_set_pmksa(struct handshake_state *s,
 					struct pmksa *pmksa)
 {
-	/* checks for both expiration || pmksa being set */
-	if (s->expiration)
+	uint64_t now = l_time_now();
+
+	if (s->expiration && l_time_after(now, s->expiration))
 		return false;
 
 	s->pmksa = pmksa;
-- 
2.34.1