提交 fefd9e6f 编写于 作者: C Cong Ding 提交者: Benjamin Herrenschmidt

powerpc: kernel/kgdb.c: Fix memory leakage

the variable backup_current_thread_info isn't freed before existing the
function.
Signed-off-by: NCong Ding <dinggnu@gmail.com>
Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
上级 572177d7
......@@ -154,12 +154,12 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs)
static int kgdb_singlestep(struct pt_regs *regs)
{
struct thread_info *thread_info, *exception_thread_info;
struct thread_info *backup_current_thread_info = \
(struct thread_info *)kmalloc(sizeof(struct thread_info), GFP_KERNEL);
struct thread_info *backup_current_thread_info;
if (user_mode(regs))
return 0;
backup_current_thread_info = (struct thread_info *)kmalloc(sizeof(struct thread_info), GFP_KERNEL);
/*
* On Book E and perhaps other processors, singlestep is handled on
* the critical exception stack. This causes current_thread_info()
......@@ -185,6 +185,7 @@ static int kgdb_singlestep(struct pt_regs *regs)
/* Restore current_thread_info lastly. */
memcpy(exception_thread_info, backup_current_thread_info, sizeof *thread_info);
kfree(backup_current_thread_info);
return 1;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册