Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 86469
b: refs/heads/master
c: 4e29e9e
h: refs/heads/master
i:
  86467: 0c557dc
v: v3
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Feb 27, 2008
1 parent efc53b9 commit 37050ad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 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: 3bdfe7ec08b4256121a8894cd978e74fcf7031d7
refs/heads/master: 4e29e9ec7e0707d3925f5dcc29af0d3f04e49833
15 changes: 12 additions & 3 deletions trunk/net/netfilter/nf_conntrack_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,19 @@ __nf_conntrack_find(const struct nf_conntrack_tuple *tuple)
struct hlist_node *n;
unsigned int hash = hash_conntrack(tuple);

/* Disable BHs the entire time since we normally need to disable them
* at least once for the stats anyway.
*/
local_bh_disable();
hlist_for_each_entry_rcu(h, n, &nf_conntrack_hash[hash], hnode) {
if (nf_ct_tuple_equal(tuple, &h->tuple)) {
NF_CT_STAT_INC(found);
local_bh_enable();
return h;
}
NF_CT_STAT_INC(searched);
}
local_bh_enable();

return NULL;
}
Expand Down Expand Up @@ -400,17 +406,20 @@ nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple,
struct hlist_node *n;
unsigned int hash = hash_conntrack(tuple);

rcu_read_lock();
/* Disable BHs the entire time since we need to disable them at
* least once for the stats anyway.
*/
rcu_read_lock_bh();
hlist_for_each_entry_rcu(h, n, &nf_conntrack_hash[hash], hnode) {
if (nf_ct_tuplehash_to_ctrack(h) != ignored_conntrack &&
nf_ct_tuple_equal(tuple, &h->tuple)) {
NF_CT_STAT_INC(found);
rcu_read_unlock();
rcu_read_unlock_bh();
return 1;
}
NF_CT_STAT_INC(searched);
}
rcu_read_unlock();
rcu_read_unlock_bh();

return 0;
}
Expand Down

0 comments on commit 37050ad

Please sign in to comment.