git: c343c445e2c9 - main - lindebugfs: Free the kcov symlink when the module is unloaded

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Wed, 18 Nov 2026 07:42:07 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=c343c445e2c9ef2c865aaabb9c56ab143b04adb7

commit c343c445e2c9ef2c865aaabb9c56ab143b04adb7
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2026-11-04 08:14:38 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2026-11-18 07:42:02 +0000

    lindebugfs: Free the kcov symlink when the module is unloaded
    
    lindebugfs_init() creates the "kcov" symlink with debugfs_create_symlink(),
    which allocates a node and a copy of the destination, but passed no destroy
    callback to pfs_create_link().  pseudofs therefore never released them and
    the "debugfsint" malloc type was reported as leaking memory each time the
    module was unloaded.
    
    Use debugfs_destroy(), as done for the other nodes.
    
    Differential Revision:  https://reviews.freebsd.org/D61221
---
 sys/compat/lindebugfs/lindebugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/compat/lindebugfs/lindebugfs.c b/sys/compat/lindebugfs/lindebugfs.c
index b79990ae36d4..b26d2b31b62f 100644
--- a/sys/compat/lindebugfs/lindebugfs.c
+++ b/sys/compat/lindebugfs/lindebugfs.c
@@ -349,7 +349,7 @@ debugfs_create_symlink(const char *name, struct dentry *parent,
 		pnode = debugfs_root;
 
 	pfs_create_link(pnode, &dnode->d_pfs_node, name, &debugfs_fill_data,
-	    NULL, NULL, NULL, PFS_NOWAIT);
+	    NULL, NULL, debugfs_destroy, PFS_NOWAIT);
 	if (dnode->d_pfs_node == NULL)
 		goto fail;
 	dnode->d_pfs_node->pn_data = dm;