“4791d63bd40ec63c533060707dae0232b9969dc0”上不存在“...include/git@gitcode.net:openanolis/cloud-kernel.git”
提交 fa196d76 编写于 作者: L Liao Chang 提交者: Zheng Zengkai

csky/kprobe: reclaim insn_slot on kprobe unregistration

stable inclusion
from stable-v5.10.138
commit fa45327d8c52d82a680cbe48f81ff371a4408514
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I60QFD

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=fa45327d8c52d82a680cbe48f81ff371a4408514

--------------------------------

[ Upstream commit a2310c74 ]

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: NChen Guokai <chenguokai17@mails.ucas.ac.cn>
Reviewed-by: NMasami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: NLiao Chang <liaochang1@huawei.com>
Signed-off-by: NGuo Ren <guoren@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 d28467c6
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册