diff options
author | Kristof Provost <kp@FreeBSD.org> | 2023-03-20 13:26:33 +0000 |
---|---|---|
committer | Kristof Provost <kp@FreeBSD.org> | 2023-03-27 08:16:03 +0000 |
commit | 3eb2341caaa307a8d067333c8aebe3e269ade2fd (patch) | |
tree | e17d08d348bca94a2ebb1d082a5f4ed5fc1391e7 | |
parent | 44af4103e422029026e9bb1a5784550365831cf3 (diff) | |
download | src-3eb2341caaa307a8d067333c8aebe3e269ade2fd.tar.gz src-3eb2341caaa307a8d067333c8aebe3e269ade2fd.zip |
pfsync: add missing unlock in pfsync_defer_tmo()
The callout for pfsync_defer_tmo() is created with
CALLOUT_RETURNUNLOCKED, because while the callout framework takes care
of taking the lock we want to run a few operations outside of the lock,
so we unlock ourselves.
However, if `sc->sc_sync_if == NULL` we return without releasing the
lock, and leak the lock, causing later deadlocks.
Ensure we always release the bucket lock when we exit pfsync_defer_tmo()
PR: 268246
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC (Netgate)
(cherry picked from commit 844ad2828a35c434b893af4274b1f6c50332dd70)
-rw-r--r-- | sys/netpfil/pf/if_pfsync.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 3b3d263fcf8b..0a8ece621006 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1830,8 +1830,10 @@ pfsync_defer_tmo(void *arg) PFSYNC_BUCKET_LOCK_ASSERT(b); - if (sc->sc_sync_if == NULL) + if (sc->sc_sync_if == NULL) { + PFSYNC_BUCKET_UNLOCK(b); return; + } NET_EPOCH_ENTER(et); CURVNET_SET(sc->sc_sync_if->if_vnet); |