From: yasuoka Date: Sun, 24 Sep 2023 05:56:06 +0000 (+0000) Subject: The stage queue should be freeed when wg_peer is destroyed. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=76ac1d3d68ce58273682ca93fb9ef22a9fc46fec;p=openbsd The stage queue should be freeed when wg_peer is destroyed. diff from IIJ. ok bluhm mvs --- 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);