mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-07 13:15:12 +02:00
condition: squash variables
This commit is contained in:
@@ -126,7 +126,7 @@ condition_mt_check(const char *tablename, const void *entry,
|
|||||||
{
|
{
|
||||||
const struct xt_condition_mtinfo *info = matchinfo;
|
const struct xt_condition_mtinfo *info = matchinfo;
|
||||||
struct list_head *pos;
|
struct list_head *pos;
|
||||||
struct condition_variable *var, *newvar;
|
struct condition_variable *var;
|
||||||
|
|
||||||
/* Forbid certain names */
|
/* Forbid certain names */
|
||||||
if (*info->name == '\0' || *info->name == '.' ||
|
if (*info->name == '\0' || *info->name == '.' ||
|
||||||
@@ -154,34 +154,34 @@ condition_mt_check(const char *tablename, const void *entry,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* At this point, we need to allocate a new condition variable. */
|
/* At this point, we need to allocate a new condition variable. */
|
||||||
newvar = kmalloc(sizeof(struct condition_variable), GFP_KERNEL);
|
var = kmalloc(sizeof(struct condition_variable), GFP_KERNEL);
|
||||||
|
|
||||||
if (newvar == NULL) {
|
if (var == NULL) {
|
||||||
up(&proc_lock);
|
up(&proc_lock);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the condition variable's proc file entry. */
|
/* Create the condition variable's proc file entry. */
|
||||||
newvar->status_proc = create_proc_entry(info->name, condition_list_perms, proc_net_condition);
|
var->status_proc = create_proc_entry(info->name, condition_list_perms, proc_net_condition);
|
||||||
|
|
||||||
if (newvar->status_proc == NULL) {
|
if (var->status_proc == NULL) {
|
||||||
kfree(newvar);
|
kfree(var);
|
||||||
up(&proc_lock);
|
up(&proc_lock);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
newvar->refcount = 1;
|
var->refcount = 1;
|
||||||
newvar->enabled = false;
|
var->enabled = false;
|
||||||
newvar->status_proc->owner = THIS_MODULE;
|
var->status_proc->owner = THIS_MODULE;
|
||||||
newvar->status_proc->data = newvar;
|
var->status_proc->data = var;
|
||||||
wmb();
|
wmb();
|
||||||
newvar->status_proc->read_proc = condition_proc_read;
|
var->status_proc->read_proc = condition_proc_read;
|
||||||
newvar->status_proc->write_proc = condition_proc_write;
|
var->status_proc->write_proc = condition_proc_write;
|
||||||
|
|
||||||
list_add_rcu(&newvar->list, &conditions_list);
|
list_add_rcu(&var->list, &conditions_list);
|
||||||
|
|
||||||
newvar->status_proc->uid = condition_uid_perms;
|
var->status_proc->uid = condition_uid_perms;
|
||||||
newvar->status_proc->gid = condition_gid_perms;
|
var->status_proc->gid = condition_gid_perms;
|
||||||
|
|
||||||
up(&proc_lock);
|
up(&proc_lock);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user