Skip to content

Commit a2310c7

Browse files
Liao Changguoren83
authored andcommitted
csky/kprobe: reclaim insn_slot on kprobe unregistration
On kprobe registration kernel allocate one insn_slot for new kprobe, but it forget to reclaim the insn_slot on unregistration, leading to a potential leakage. Reported-by: Chen Guokai <chenguokai17@mails.ucas.ac.cn> Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Liao Chang <liaochang1@huawei.com> Signed-off-by: Guo Ren <guoren@kernel.org>
1 parent ff69927 commit a2310c7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

arch/csky/kernel/probes/kprobes.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
124124

125125
void __kprobes arch_remove_kprobe(struct kprobe *p)
126126
{
127+
if (p->ainsn.api.insn) {
128+
free_insn_slot(p->ainsn.api.insn, 0);
129+
p->ainsn.api.insn = NULL;
130+
}
127131
}
128132

129133
static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)

0 commit comments

Comments
 (0)