Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet/dev/sdt dtrace_sdt: Fix bug in builtin m...



details:   https://anonhg.NetBSD.org/src/rev/bc4ae69eaa1c
branches:  trunk
changeset: 369777:bc4ae69eaa1c
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Aug 31 12:34:04 2022 +0000

description:
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.

diffstat:

 external/cddl/osnet/dev/sdt/sdt.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r c75a59e01ef0 -r bc4ae69eaa1c external/cddl/osnet/dev/sdt/sdt.c
--- a/external/cddl/osnet/dev/sdt/sdt.c Wed Aug 31 12:18:41 2022 +0000
+++ b/external/cddl/osnet/dev/sdt/sdt.c Wed Aug 31 12:34:04 2022 +0000
@@ -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 @@
 
        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 @@
        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"));



Home | Main Index | Thread Index | Old Index