From 1ab4e22bd0f34df43ab39b3f95346b30e0f0539c Mon Sep 17 00:00:00 2001 From: Vyacheslav Cherkashin Date: Tue, 19 Apr 2016 17:45:52 +0300 Subject: [PATCH] [FIX] sspt_proc struct double put Change-Id: Ie5cdf0e69292dddc4ec0a24004b65932b0151a71 Signed-off-by: Vyacheslav Cherkashin --- us_manager/pf/pf_group.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/us_manager/pf/pf_group.c b/us_manager/pf/pf_group.c index a8fad77..4a81560 100644 --- a/us_manager/pf/pf_group.c +++ b/us_manager/pf/pf_group.c @@ -508,11 +508,15 @@ static enum pf_inst_flag pfg_check_task(struct task_struct *task) pfg_list_rlock(); list_for_each_entry(pfg, &pfg_list, list) { + bool put_flag = false; + if (check_task_f(&pfg->filter, task) == NULL) continue; - if (proc == NULL) + if (proc == NULL) { proc = sspt_proc_get_by_task(task); + put_flag = !!proc; + } if (proc) { flag = flag == PIF_NONE ? PIF_SECOND : flag; @@ -522,6 +526,7 @@ static enum pf_inst_flag pfg_check_task(struct task_struct *task) printk(KERN_ERR "cannot create sspt_proc\n"); break; } + put_flag = true; flag = PIF_FIRST; } @@ -534,7 +539,8 @@ static enum pf_inst_flag pfg_check_task(struct task_struct *task) flag = flag == PIF_FIRST ? flag : PIF_ADD_PFG; } mutex_unlock(&proc->filters.mtx); - sspt_proc_put(proc); + if (put_flag) + sspt_proc_put(proc); } } pfg_list_runlock(); -- 2.7.4