Skip to content

Commit

Permalink
kprobes: No need to unlock kprobe_insn_mutex
Browse files Browse the repository at this point in the history
Remove needless kprobe_insn_mutex unlocking during safety check
in garbage collection, because if someone releases a dirty slot
during safety check (which ensures other cpus doesn't execute
all dirty slots), the safety check must be fail. So, we need to
hold the mutex while checking safety.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
LKML-Reference: <20090630210809.17851.28781.stgit@localhost.localdomain>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Masami Hiramatsu authored and Ingo Molnar committed Jul 1, 2009
1 parent 238a24f commit 4a2bb6f
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,9 @@ static int __kprobes collect_garbage_slots(void)
{
struct kprobe_insn_page *kip;
struct hlist_node *pos, *next;
int safety;

/* Ensure no-one is preepmted on the garbages */
mutex_unlock(&kprobe_insn_mutex);
safety = check_safety();
mutex_lock(&kprobe_insn_mutex);
if (safety != 0)
if (check_safety())
return -EAGAIN;

hlist_for_each_entry_safe(kip, pos, next, &kprobe_insn_pages, hlist) {
Expand Down

0 comments on commit 4a2bb6f

Please sign in to comment.