#include <linux/list.h>
#include <linux/namei.h>
#include <linux/mman.h>
+#include <linux/spinlock.h>
#include "pf_group.h"
#include "proc_filters.h"
#include "../sspt/sspt_filter.h"
struct pfg_msg_cb *msg_cb;
atomic_t usage;
- /* TODO: proc_list*/
+ spinlock_t pl_lock; /* for proc_list */
struct list_head proc_list;
};
INIT_LIST_HEAD(&pfg->list);
memset(&pfg->filter, 0, sizeof(pfg->filter));
+ spin_lock_init(&pfg->pl_lock);
INIT_LIST_HEAD(&pfg->proc_list);
pfg->msg_cb = NULL;
atomic_set(&pfg->usage, 1);
if (pls == NULL)
return -ENOMEM;
+ spin_lock(&pfg->pl_lock);
add_pl_struct(pfg, pls);
+ spin_unlock(&pfg->pl_lock);
return 0;
}
read_lock(&pfg_list_lock);
list_for_each_entry(pfg, &pfg_list, list) {
+ spin_lock(&pfg->pl_lock);
pls = find_pl_struct(pfg, task);
if (pls) {
del_pl_struct(pls);
free_pl_struct(pls);
}
+ spin_unlock(&pfg->pl_lock);
}
read_unlock(&pfg_list_lock);