Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 202944
b: refs/heads/master
c: f5c5440
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and Patrick McHardy committed Jun 14, 2010
1 parent bd4a035 commit 3e109af
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bed1be20867d17a3eb2fb5e1613ebdc50c83b8aa
refs/heads/master: f5c5440d40a24c5dc8030cde0a03debe87de4afb
1 change: 1 addition & 0 deletions trunk/include/linux/netfilter/nfnetlink_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ enum nfulnl_attr_config {
#define NFULNL_COPY_NONE 0x00
#define NFULNL_COPY_META 0x01
#define NFULNL_COPY_PACKET 0x02
#define NFULNL_COPY_DISABLED 0x03

#define NFULNL_CFG_F_SEQ 0x0001
#define NFULNL_CFG_F_SEQ_GLOBAL 0x0002
Expand Down
18 changes: 12 additions & 6 deletions trunk/net/netfilter/nfnetlink_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ instance_lookup_get(u_int16_t group_num)

rcu_read_lock_bh();
inst = __instance_lookup(group_num);
if (inst)
instance_get(inst);
if (inst && !atomic_inc_not_zero(&inst->use))
inst = NULL;
rcu_read_unlock_bh();

return inst;
Expand Down Expand Up @@ -171,7 +171,7 @@ instance_create(u_int16_t group_num, int pid)
inst->copy_mode = NFULNL_COPY_PACKET;
inst->copy_range = NFULNL_COPY_RANGE_MAX;

hlist_add_head(&inst->hlist,
hlist_add_head_rcu(&inst->hlist,
&instance_table[instance_hashfn(group_num)]);

spin_unlock_bh(&instances_lock);
Expand All @@ -185,18 +185,23 @@ instance_create(u_int16_t group_num, int pid)

static void __nfulnl_flush(struct nfulnl_instance *inst);

/* called with BH disabled */
static void
__instance_destroy(struct nfulnl_instance *inst)
{
/* first pull it out of the global list */
hlist_del(&inst->hlist);
hlist_del_rcu(&inst->hlist);

/* then flush all pending packets from skb */

spin_lock_bh(&inst->lock);
spin_lock(&inst->lock);

/* lockless readers wont be able to use us */
inst->copy_mode = NFULNL_COPY_DISABLED;

if (inst->skb)
__nfulnl_flush(inst);
spin_unlock_bh(&inst->lock);
spin_unlock(&inst->lock);

/* and finally put the refcount */
instance_put(inst);
Expand Down Expand Up @@ -624,6 +629,7 @@ nfulnl_log_packet(u_int8_t pf,
size += nla_total_size(data_len);
break;

case NFULNL_COPY_DISABLED:
default:
goto unlock_and_release;
}
Expand Down

0 comments on commit 3e109af

Please sign in to comment.