[FIX] Acquire/release reference to the task in sspt_proc 12/47312/3
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Wed, 2 Sep 2015 07:19:14 +0000 (10:19 +0300)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Mon, 7 Sep 2015 08:35:35 +0000 (01:35 -0700)
It prevents invalid pointer dereference if the task has already
been terminated.

Change-Id: I8525d16d81a177d13c5a88f507e070214db81fc7
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
us_manager/sspt/sspt_proc.c

index fae2e3f..1c066ce 100644 (file)
@@ -111,6 +111,8 @@ struct sspt_proc *sspt_proc_create(struct task_struct *task)
                INIT_LIST_HEAD(&proc->filter_list);
                atomic_set(&proc->usage, 1);
 
+               get_task_struct(proc->task);
+
                /* add to list */
                list_add(&proc->list, &proc_probes_list);
        }
@@ -161,6 +163,8 @@ void sspt_proc_put(struct sspt_proc *proc)
                        put_task_struct(proc->__task);
                        proc->__task = NULL;
                }
+
+               put_task_struct(proc->task);
                kfree(proc);
        }
 }