git: 81e6c0168d46 - main - lindebugfs.c: Fix possible NULL dereference
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 23 Jun 2025 21:54:28 UTC
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);