Module Name: src
Committed By: riastradh
Date: Wed Aug 31 12:34:04 UTC 2022
Modified Files:
src/external/cddl/osnet/dev/sdt: sdt.c
Log Message:
dtrace_sdt: Fix bug in builtin module reference counting.
Don't module_hold(NULL)! This mistake was introduced in my attempt
to get dtrace working for sdt probes defined in non-builtin modules
like zfs.
To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/cddl/osnet/dev/sdt/sdt.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/cddl/osnet/dev/sdt/sdt.c
diff -u src/external/cddl/osnet/dev/sdt/sdt.c:1.23 src/external/cddl/osnet/dev/sdt/sdt.c:1.24
--- src/external/cddl/osnet/dev/sdt/sdt.c:1.23 Sun Aug 7 23:42:09 2022
+++ src/external/cddl/osnet/dev/sdt/sdt.c Wed Aug 31 12:34:04 2022
@@ -39,7 +39,7 @@
* unloaded; in particular, probes may not span multiple kernel modules.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.23 2022/08/07 23:42:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.24 2022/08/31 12:34:04 riastradh Exp $");
#include <sys/cdefs.h>
#include <sys/proc.h>
@@ -270,7 +270,8 @@ sdt_enable(void *arg __unused, dtrace_id
probe->id = id;
#ifdef __NetBSD__
- module_hold(&probe->sdtp_lf->lf_mod);
+ if (probe->sdtp_lf)
+ module_hold(&probe->sdtp_lf->lf_mod);
#endif
#ifdef __FreeBSD__
probe->sdtp_lf->nenabled++;
@@ -286,7 +287,8 @@ sdt_disable(void *arg __unused, dtrace_i
struct sdt_probe *probe = parg;
#ifdef __NetBSD__
- module_rele(&probe->sdtp_lf->lf_mod);
+ if (probe->sdtp_lf)
+ module_rele(&probe->sdtp_lf->lf_mod);
#endif
#ifdef __FreeBSD__
SDT_KASSERT(probe->sdtp_lf->nenabled > 0, ("no probes enabled"));