Skip to content

Commit 4a2bb6f

Browse files
Masami HiramatsuIngo Molnar
authored andcommitted
kprobes: No need to unlock kprobe_insn_mutex
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 <[email protected]> Cc: Ananth N Mavinakayanahalli <[email protected]> Cc: Jim Keniston <[email protected]> Cc: Ananth N Mavinakayanahalli <[email protected]> LKML-Reference: <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent 238a24f commit 4a2bb6f

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

kernel/kprobes.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,9 @@ static int __kprobes collect_garbage_slots(void)
237237
{
238238
struct kprobe_insn_page *kip;
239239
struct hlist_node *pos, *next;
240-
int safety;
241240

242241
/* Ensure no-one is preepmted on the garbages */
243-
mutex_unlock(&kprobe_insn_mutex);
244-
safety = check_safety();
245-
mutex_lock(&kprobe_insn_mutex);
246-
if (safety != 0)
242+
if (check_safety())
247243
return -EAGAIN;
248244

249245
hlist_for_each_entry_safe(kip, pos, next, &kprobe_insn_pages, hlist) {

0 commit comments

Comments
 (0)