diff options
author | Patrick McHardy <kaber@trash.net> | 2007-07-08 01:32:03 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-11 01:17:56 -0400 |
commit | 4e1d4e6c5a448bd114e0cef6311c974cb7c7385e (patch) | |
tree | aa785c5d14b7796de154872a754ae9e25df6650b /net | |
parent | d4156e8cd93f5772483928aaf4960120caebd789 (diff) |
[NETFILTER]: nf_conntrack_expect: avoid useless list walking
Don't walk the list when unexpecting an expectation, we already
have a reference and the timer check is enough to guarantee
that it still is on the list.
This comment suggests that it was copied there by mistake from
expectation eviction:
/* choose the oldest expectation to evict */
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nf_conntrack_expect.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c index 83b5ad85e0ee..5c8cb0f243a2 100644 --- a/net/netfilter/nf_conntrack_expect.c +++ b/net/netfilter/nf_conntrack_expect.c | |||
@@ -165,17 +165,10 @@ static inline int expect_matches(const struct nf_conntrack_expect *a, | |||
165 | /* Generally a bad idea to call this: could have matched already. */ | 165 | /* Generally a bad idea to call this: could have matched already. */ |
166 | void nf_ct_unexpect_related(struct nf_conntrack_expect *exp) | 166 | void nf_ct_unexpect_related(struct nf_conntrack_expect *exp) |
167 | { | 167 | { |
168 | struct nf_conntrack_expect *i; | ||
169 | |||
170 | write_lock_bh(&nf_conntrack_lock); | 168 | write_lock_bh(&nf_conntrack_lock); |
171 | /* choose the oldest expectation to evict */ | 169 | if (del_timer(&exp->timeout)) { |
172 | list_for_each_entry_reverse(i, &nf_ct_expect_list, list) { | 170 | nf_ct_unlink_expect(exp); |
173 | if (expect_matches(i, exp) && del_timer(&i->timeout)) { | 171 | nf_ct_expect_put(exp); |
174 | nf_ct_unlink_expect(i); | ||
175 | write_unlock_bh(&nf_conntrack_lock); | ||
176 | nf_ct_expect_put(i); | ||
177 | return; | ||
178 | } | ||
179 | } | 172 | } |
180 | write_unlock_bh(&nf_conntrack_lock); | 173 | write_unlock_bh(&nf_conntrack_lock); |
181 | } | 174 | } |