diff options
| author | Liao Chang <liaochang1@huawei.com> | 2022-05-25 16:02:41 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-08-25 11:40:38 +0200 |
| commit | 3645ed60ac07982b549ffa2d3717971ec73033c2 (patch) | |
| tree | b0ae3882205647ee3b5c02ec2ee3ab03192fb1a7 /arch/csky | |
| parent | fda4bff43bcdb2faf56722d6bb9a996e1dcea2e1 (diff) | |
| download | linux-3645ed60ac07982b549ffa2d3717971ec73033c2.tar.gz linux-3645ed60ac07982b549ffa2d3717971ec73033c2.tar.bz2 linux-3645ed60ac07982b549ffa2d3717971ec73033c2.zip | |
csky/kprobe: reclaim insn_slot on kprobe unregistration
[ Upstream commit a2310c74d418deca0f1d749c45f1f43162510f51 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch/csky')
| -rw-r--r-- | arch/csky/kernel/probes/kprobes.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/csky/kernel/probes/kprobes.c b/arch/csky/kernel/probes/kprobes.c index 4045894d9280..584ed9f36290 100644 --- a/arch/csky/kernel/probes/kprobes.c +++ b/arch/csky/kernel/probes/kprobes.c @@ -124,6 +124,10 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p) void __kprobes arch_remove_kprobe(struct kprobe *p) { + if (p->ainsn.api.insn) { + free_insn_slot(p->ainsn.api.insn, 0); + p->ainsn.api.insn = NULL; + } } static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) |
