diff --git a/kernel/tkernel/killblock/kill_block.c b/kernel/tkernel/killblock/kill_block.c index 50e8484bd51d3af5426ad422aa7fa80886c9f95c..5271f615530db57e4d47a9f984579a019ddbe2e5 100644 --- a/kernel/tkernel/killblock/kill_block.c +++ b/kernel/tkernel/killblock/kill_block.c @@ -75,8 +75,8 @@ static ssize_t whitelist_write(struct file *file, const char __user *ubuf, list_del(&rule->node); kfree(rule); } - write_unlock(&whitelist_lock); atomic_set(&kb_rule_cnt, 0); + write_unlock(&whitelist_lock); return count; } return -EINVAL; @@ -111,8 +111,8 @@ static ssize_t whitelist_write(struct file *file, const char __user *ubuf, } } list_add(&rule->node, &whitelist_list); - write_unlock(&whitelist_lock); atomic_inc(&kb_rule_cnt); + write_unlock(&whitelist_lock); } else if (!strcmp(token[0], "del")) { write_lock(&whitelist_lock); list_for_each_entry_safe(rule, tmp, &whitelist_list, node) { @@ -120,9 +120,9 @@ static ssize_t whitelist_write(struct file *file, const char __user *ubuf, !strcasecmp(rule->dst_comm, token[2]) && !strcasecmp(rule->dst_cgrp, token[3])) { list_del(&rule->node); + atomic_dec(&kb_rule_cnt); write_unlock(&whitelist_lock); kfree(rule); - atomic_dec(&kb_rule_cnt); return count; } } diff --git a/kernel/tkernel/killprotect/kill_protect.c b/kernel/tkernel/killprotect/kill_protect.c index 4474cad05b140197c9946ebb83267f625af47780..28f3ec1fd254c594147245b692214dccac914019 100644 --- a/kernel/tkernel/killprotect/kill_protect.c +++ b/kernel/tkernel/killprotect/kill_protect.c @@ -70,8 +70,8 @@ static ssize_t blacklist_write(struct file *file, const char __user *ubuf, list_del(&rule->node); kfree(rule); } - write_unlock(&blacklist_lock); atomic_set(&kp_rule_cnt, 0); + write_unlock(&blacklist_lock); return count; } return -EINVAL; @@ -100,8 +100,8 @@ static ssize_t blacklist_write(struct file *file, const char __user *ubuf, } } list_add(&rule->node, &blacklist_list); - write_unlock(&blacklist_lock); atomic_inc(&kp_rule_cnt); + write_unlock(&blacklist_lock); } else if (strcmp(token[0], "del") == 0) { cnt = min_t(size_t, TASK_COMM_LEN - 1, strlen(token[1])); strncpy(comm, token[1], cnt); @@ -111,9 +111,9 @@ static ssize_t blacklist_write(struct file *file, const char __user *ubuf, list_for_each_entry_safe(rule, tmp, &blacklist_list, node) { if (strcmp(rule->comm, comm) == 0) { list_del(&rule->node); + atomic_dec(&kp_rule_cnt); write_unlock(&blacklist_lock); kfree(rule); - atomic_dec(&kp_rule_cnt); return count; } }