From 76ac1d3d68ce58273682ca93fb9ef22a9fc46fec Mon Sep 17 00:00:00 2001 From: yasuoka Date: Sun, 24 Sep 2023 05:56:06 +0000 Subject: [PATCH] The stage queue should be freeed when wg_peer is destroyed. diff from IIJ. ok bluhm mvs --- sys/net/if_wg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/net/if_wg.c b/sys/net/if_wg.c index 593bfc6a6db..889d93acd0e 100644 --- a/sys/net/if_wg.c +++ b/sys/net/if_wg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wg.c,v 1.29 2023/08/03 09:49:08 mvs Exp $ */ +/* $OpenBSD: if_wg.c,v 1.30 2023/09/24 05:56:06 yasuoka Exp $ */ /* * Copyright (C) 2015-2020 Jason A. Donenfeld . All Rights Reserved. @@ -518,6 +518,9 @@ wg_peer_destroy(struct wg_peer *peer) taskq_barrier(wg_crypt_taskq); taskq_barrier(net_tq(sc->sc_if.if_index)); + if (!mq_empty(&peer->p_stage_queue)) + mq_purge(&peer->p_stage_queue); + DPRINTF(sc, "Peer %llu destroyed\n", peer->p_id); explicit_bzero(peer, sizeof(*peer)); pool_put(&wg_peer_pool, peer); -- 2.20.1