From: Jesper Juhl <jesper.juhl@gmail.com>
To: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: LKML <linux-kernel@vger.kernel.org>, Jesper Juhl <jesper.juhl@gmail.com>
Subject: [PATCH] Don't risk NULL deref in marker
Date: Tue, 26 Feb 2008 00:14:24 +0100 [thread overview]
Message-ID: <200802260014.24253.jesper.juhl@gmail.com> (raw)
get_marker() may return NULL, so test for it.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---
diff --git a/kernel/marker.c b/kernel/marker.c
index 50effc0..f211f08 100644
--- a/kernel/marker.c
+++ b/kernel/marker.c
@@ -698,12 +698,11 @@ int marker_probe_unregister(const char *name,
{
struct marker_entry *entry;
struct marker_probe_closure *old;
- int ret = 0;
+ int ret = -ENOENT;
mutex_lock(&markers_mutex);
entry = get_marker(name);
if (!entry) {
- ret = -ENOENT;
goto end;
}
if (entry->rcu_pending)
@@ -713,12 +712,16 @@ int marker_probe_unregister(const char *name,
marker_update_probes(); /* may update entry */
mutex_lock(&markers_mutex);
entry = get_marker(name);
+ if (!entry) {
+ goto end;
+ }
entry->oldptr = old;
entry->rcu_pending = 1;
/* write rcu_pending before calling the RCU callback */
smp_wmb();
call_rcu(&entry->rcu, free_old_closure);
remove_marker(name); /* Ignore busy error message */
+ ret = 0;
end:
mutex_unlock(&markers_mutex);
return ret;
next reply other threads:[~2008-02-25 23:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-25 23:14 Jesper Juhl [this message]
2008-02-26 2:59 ` [PATCH] Don't risk NULL deref in marker Mathieu Desnoyers
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=200802260014.24253.jesper.juhl@gmail.com \
--to=jesper.juhl@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
/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