From 3d3f53b4eef1dfc8180595cb9b07c8e42371e596 Mon Sep 17 00:00:00 2001 From: dlg Date: Sat, 14 Mar 2026 00:10:38 +0000 Subject: [PATCH] plug a memory leak when detaching codel ifq disciplines on an interface. fqcodel_alloc() takes (moves) ownership of memory allocated as part of the pf queue code that sets up the queue discipline, but nothing releases it when the discipline is removed from the interface. every time you load a pf rulese that uses codel, it temporarily resets an interface to priq before creating and attaching new codel instances. this means every ruleset load would leak memory, to the point where M_DEVBUF allocations exhaust the kernel map. this has fqcodel_free() call fqcodel_pf_free to free the now unused codel discipline. found and fixed by lexi wilson --- sys/net/fq_codel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/fq_codel.c b/sys/net/fq_codel.c index 751c23253d1..eb49c18aa5c 100644 --- a/sys/net/fq_codel.c +++ b/sys/net/fq_codel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fq_codel.c,v 1.19 2025/11/13 20:07:22 bket Exp $ */ +/* $OpenBSD: fq_codel.c,v 1.20 2026/03/14 00:10:38 dlg Exp $ */ /* * Copyright (c) 2017 Mike Belopuhov @@ -908,5 +908,5 @@ fqcodel_alloc(unsigned int idx, void *arg) void fqcodel_free(unsigned int idx, void *arg) { - /* nothing to do here */ + fqcodel_pf_free(arg); }