[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220525080241.117084-1-liaochang1@huawei.com>
Date: Wed, 25 May 2022 16:02:41 +0800
From: Liao Chang <liaochang1@...wei.com>
To: <guoren@...nel.org>, <mhiramat@...nel.org>, <rostedt@...dmis.org>,
<peterz@...radead.org>, <liaochang1@...wei.com>, <lkp@...el.com>,
<naveen.n.rao@...ux.vnet.ibm.com>, <jszhang@...nel.org>
CC: <linux-csky@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] 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@...ls.ucas.ac.cn>
Signed-off-by: Liao Chang <liaochang1@...wei.com>
---
arch/csky/kernel/probes/kprobes.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/csky/kernel/probes/kprobes.c b/arch/csky/kernel/probes/kprobes.c
index 42920f25e73c..661da54b418f 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)
--
2.17.1
Powered by blists - more mailing lists