From: eugene.loh@oracle.com
To: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: [PATCH v2] Guard against inserting the same provider twice
Date: Fri, 16 Jan 2026 15:38:12 -0500 [thread overview]
Message-ID: <20260116203812.21552-1-eugene.loh@oracle.com> (raw)
From: Eugene Loh <eugene.loh@oracle.com>
Add a safety net to dt_provider_create(), to check if a specified
provider has already been inserted.
This also requires a corresponding change in dt_provider_lookup(), so
that it will work even if no providers have yet been inserted.
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
libdtrace/dt_provider.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/libdtrace/dt_provider.c b/libdtrace/dt_provider.c
index 848fdc132..e073e1f2d 100644
--- a/libdtrace/dt_provider.c
+++ b/libdtrace/dt_provider.c
@@ -1,6 +1,6 @@
/*
* Oracle Linux DTrace.
- * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2026, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
@@ -110,6 +110,9 @@ dt_provider_lookup(dtrace_hdl_t *dtp, const char *name)
{
dt_provider_t tmpl;
+ if (dtp->dt_provs == NULL)
+ return NULL;
+
if ((strlen(name) + 1) > sizeof(tmpl.desc.dtvd_name))
return NULL;
@@ -124,6 +127,10 @@ dt_provider_create(dtrace_hdl_t *dtp, const char *name,
{
dt_provider_t *pvp;
+ pvp = dt_provider_lookup(dtp, name);
+ if (pvp)
+ return pvp;
+
if ((pvp = dt_zalloc(dtp, sizeof(dt_provider_t))) == NULL)
goto nomem;
--
2.47.3
next reply other threads:[~2026-01-16 20:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 20:38 eugene.loh [this message]
2026-01-16 21:53 ` [PATCH v2] Guard against inserting the same provider twice Kris Van Hees
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260116203812.21552-1-eugene.loh@oracle.com \
--to=eugene.loh@oracle.com \
--cc=dtrace-devel@oss.oracle.com \
--cc=dtrace@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox