Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 45783
b: refs/heads/master
c: a6c7ab5
h: refs/heads/master
i:
  45781: fa5ce5e
  45779: c076e38
  45775: e6e5f30
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed Jan 24, 2007
1 parent 1155d5b commit 9f30654
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 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: 8f1adb5f27d352c776ac34648cc277d1f8199dba
refs/heads/master: a6c7ab55dda3e16ab5a3cf6f39585aee5876ac3a
16 changes: 5 additions & 11 deletions trunk/net/xfrm/xfrm_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,19 +650,18 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
struct xfrm_policy *pol;
struct xfrm_policy *delpol;
struct hlist_head *chain;
struct hlist_node *entry, *newpos, *last;
struct hlist_node *entry, *newpos;
struct dst_entry *gc_list;

write_lock_bh(&xfrm_policy_lock);
chain = policy_hash_bysel(&policy->selector, policy->family, dir);
delpol = NULL;
newpos = NULL;
last = NULL;
hlist_for_each_entry(pol, entry, chain, bydst) {
if (!delpol &&
pol->type == policy->type &&
if (pol->type == policy->type &&
!selector_cmp(&pol->selector, &policy->selector) &&
xfrm_sec_ctx_match(pol->security, policy->security)) {
xfrm_sec_ctx_match(pol->security, policy->security) &&
!WARN_ON(delpol)) {
if (excl) {
write_unlock_bh(&xfrm_policy_lock);
return -EEXIST;
Expand All @@ -671,17 +670,12 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
if (policy->priority > pol->priority)
continue;
} else if (policy->priority >= pol->priority) {
last = &pol->bydst;
newpos = &pol->bydst;
continue;
}
if (!newpos)
newpos = &pol->bydst;
if (delpol)
break;
last = &pol->bydst;
}
if (!newpos)
newpos = last;
if (newpos)
hlist_add_after(newpos, &policy->bydst);
else
Expand Down

0 comments on commit 9f30654

Please sign in to comment.