From: Alexander Aksenov Date: Fri, 25 Nov 2016 16:02:42 +0000 (+0300) Subject: Uprobe: fix NULL dereference on x86 X-Git-Tag: accepted/tizen/3.0/common/20161208.153832^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=716b21cc4af3d012308b2bf6cbb83fd25c7ea53b;p=platform%2Fkernel%2Fswap-modules.git Uprobe: fix NULL dereference on x86 When uprobe_handler_part2() is called, it dereferences pre_handler callback without any check, but uprobe_handler_part2() is called itself from uprobe_handler_atomic() when pre_handler is NULL. Change-Id: Ia4cdbdc20c50aa3d891c790eea3545da06506f47 Signed-off-by: Alexander Aksenov --- diff --git a/uprobe/arch/x86/swap-asm/swap_uprobes.c b/uprobe/arch/x86/swap-asm/swap_uprobes.c index 99308bc..28de890 100644 --- a/uprobe/arch/x86/swap-asm/swap_uprobes.c +++ b/uprobe/arch/x86/swap-asm/swap_uprobes.c @@ -549,7 +549,7 @@ static int uprobe_handler_retprobe(struct uprobe *p, struct pt_regs *regs) static int uprobe_handler_part2(struct uprobe *p, struct pt_regs *regs) { - if (!p->pre_handler(p, regs)) { + if (p->pre_handler && !p->pre_handler(p, regs)) { prepare_tramp(p, regs); if (p->ainsn.boostable == 1 && !p->post_handler) goto exit_and_put_up;