Overview -------- 'if_vtnet' driver is missing the 'pfil_head_unregister()' during 'vtnet_detach()'. Included a patch, which assumes the fix for bug #256714 is also applied. Steps to Reproduce ------------------ Attach and then detach vnet device. # vmstat -m | grep pfil pfil 6 1K 5 128 # devctl attach pci0:0:4:0 virtio_pci1: <VirtIO PCI (legacy) Network adapter> port 0xc020-0xc03f mem 0xfeb92000-0xfeb92fff,0xfe004000-0xfe007fff irq 11 at device 4.0 on pci0 vtnet1: <VirtIO Networking Adapter> on virtio_pci1 pfil: duplicate head "vtnet1" 810.828154 [ 450] vtnet_netmap_attach vtnet attached txq=1, txd=256 rxq=1, rxd=128 # devctl detach pci0:0:4:0 # vmstat -m | grep pfil pfil 7 1K 6 128 Actual Results -------------- Leaks 'pfil' memory at each detach. Expected Results ---------------- All memory allocated in attach is freed in the detach. Build Date & Hardware --------------------- root@freebsd:~ # uname -a FreeBSD freebsd 13.0-RELEASE FreeBSD 13.0-RELEASE #0 releng/13.0-n244733-ea31abc261f: Fri Apr 9 04:24:09 UTC 2021 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 Additional Information ----------------------
Thank you for your report. Was a patch/attachment accidentally not included here?
Created attachment 230696 [details] Potential Fix
Yes, I neglected to attach the diff.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3f6ab5493f4b89e7625dd31f807065cfae6c503d commit 3f6ab5493f4b89e7625dd31f807065cfae6c503d Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2022-01-05 02:41:05 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2022-01-05 02:41:05 +0000 vtnet: don't leak pfil(9) data on detach PR: 260667 Submitted by: <ghuckriede blackberry.com> sys/dev/virtio/network/if_vtnet.c | 5 +++++ 1 file changed, 5 insertions(+)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=0084d02356494eb7a1b276ded9d37f3164a7248e commit 0084d02356494eb7a1b276ded9d37f3164a7248e Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2022-01-05 02:41:05 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2023-12-21 18:41:48 +0000 vtnet: don't leak pfil(9) data on detach PR: 260667 Submitted by: <ghuckriede blackberry.com> (cherry picked from commit 3f6ab5493f4b89e7625dd31f807065cfae6c503d) sys/dev/virtio/network/if_vtnet.c | 5 +++++ 1 file changed, 5 insertions(+)