summaryrefslogtreecommitdiffstats
path: root/kernel/events/uprobes.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2012-12-31 18:12:48 +0100
committerOleg Nesterov <oleg@redhat.com>2013-02-08 17:47:12 +0100
commitaba51024e7159c93914557caaa2b8cda26331091 (patch)
tree9883f94fdefa1347040be590b336e809ba6d3300 /kernel/events/uprobes.c
parenta6cb3f6d51253e9cf21a38b17c025018117809d7 (diff)
downloadlinux-aba51024e7159c93914557caaa2b8cda26331091.tar.gz
linux-aba51024e7159c93914557caaa2b8cda26331091.tar.bz2
linux-aba51024e7159c93914557caaa2b8cda26331091.zip
uprobes: Fix utask->xol_vaddr leak in pre_ssout()
pre_ssout() should do xol_free_insn_slot() if arch_uprobe_pre_xol() fails, otherwise nobody will free the allocated slot. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Anton Arapov <anton@redhat.com> Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/events/uprobes.c')
-rw-r--r--kernel/events/uprobes.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 8d9c5bcb110e..0527379dac5b 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1306,6 +1306,7 @@ pre_ssout(struct uprobe *uprobe, struct pt_regs *regs, unsigned long bp_vaddr)
{
struct uprobe_task *utask;
unsigned long xol_vaddr;
+ int err;
utask = current->utask;
@@ -1316,7 +1317,13 @@ pre_ssout(struct uprobe *uprobe, struct pt_regs *regs, unsigned long bp_vaddr)
utask->xol_vaddr = xol_vaddr;
utask->vaddr = bp_vaddr;
- return arch_uprobe_pre_xol(&uprobe->arch, regs);
+ err = arch_uprobe_pre_xol(&uprobe->arch, regs);
+ if (unlikely(err)) {
+ xol_free_insn_slot(current);
+ return err;
+ }
+
+ return 0;
}
/*