Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jun 2025 21:54:28 GMT
From:      =?utf-8?Q?Jean-S=C3=A9bastien?= =?utf-8?Q?P=C3=A9dron?= <dumbbell@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 81e6c0168d46 - main - lindebugfs.c: Fix possible NULL dereference
Message-ID:  <202506232154.55NLsSIs071374@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dumbbell:

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

commit 81e6c0168d46b0f5d5d4c5d0405caca8da24c35e
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2025-06-18 20:32:13 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2025-06-23 21:43:51 +0000

    lindebugfs.c: Fix possible NULL dereference
    
    If `debugfs_destroy()` is called early as part of error handling during
    initialzation, `pn->pn_data` is unset. This led to a panic in that if
    because `dm` is NULL.
    
    Reviewed by:    bz
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D50985
---
 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 97f73e79fb6c..50f9377ffec3 100644
--- a/sys/compat/lindebugfs/lindebugfs.c
+++ b/sys/compat/lindebugfs/lindebugfs.c
@@ -104,7 +104,7 @@ debugfs_destroy(PFS_DESTROY_ARGS)
 	struct dentry_meta *dm;
 
 	dm = pn->pn_data;
-	if (dm->dm_type == DM_SYMLINK)
+	if (dm != NULL && dm->dm_type == DM_SYMLINK)
 		free(dm->dm_data, M_DFSINT);
 
 	free(dm, M_DFSINT);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202506232154.55NLsSIs071374>