Hi Frank, 

Please review and accept the patch.

Missed utrace_engine_put() could lead to engine leaks

After reading through                                                           
                                             
https://www.redhat.com/archives/utrace-devel/2009-August/msg00093.html          
                                             
mail and from utrace code, it looks like we are                                 
                                             
leaking references to engine.  Hence this patch.  Missed                        
                                             
utrace_engine_put() could lead to engine leaks.                                 
                                             
                                                                                
                                             
This patch also partially undoes one of my previous changes to gdbstub.
    
    
Signed-off-by: Srikar Dronamraju <sri...@linux.vnet.ibm.com>
---
 kernel/ubp_xol.c      |    1 +
 kernel/uprobes_core.c |    1 +
 kernel/utrace-gdb.c   |    1 +
 3 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/kernel/ubp_xol.c b/kernel/ubp_xol.c
index f0a1a10..017b3cf 100644
--- a/kernel/ubp_xol.c
+++ b/kernel/ubp_xol.c
@@ -130,6 +130,7 @@ static int xol_create_engine(struct pid *pid, struct 
ubp_xol_area *area)
        WARN_ON(result == -EINPROGRESS);
        kref_get(&area->kref);
        put_pid(pid);
+       utrace_engine_put(engine);
        return 0;
 }
 
diff --git a/kernel/uprobes_core.c b/kernel/uprobes_core.c
index f059e3c..74d568b 100644
--- a/kernel/uprobes_core.c
+++ b/kernel/uprobes_core.c
@@ -640,6 +640,7 @@ static struct uprobe_task *uprobe_add_task(struct pid *p,
         * with the engine in place, the appropriate report_* callback
         * should handle it after we release uproc->rwsem.
         */
+       utrace_engine_put(engine);
        return utask;
 }
 
diff --git a/kernel/utrace-gdb.c b/kernel/utrace-gdb.c
index d7b3b58..21bf995 100644
--- a/kernel/utrace-gdb.c
+++ b/kernel/utrace-gdb.c
@@ -1200,6 +1200,7 @@ static int proc_gdb_open(struct inode *inode, struct file 
*filp)
         if (!ret)
                 ;
 
+       utrace_engine_put(p->engine);
         filp->private_data = p;
 
         INIT_LIST_HEAD(& p->link);

Reply via email to