Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15294
b: refs/heads/master
c: 9b78a82
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Dec 22, 2005
1 parent b2c08ad commit 48bee0e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 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: 4c7e6895027362889422e5dc437dc3238b6b4745
refs/heads/master: 9b78a82c1cf19aa813bdaa184fa840a3ba811750
30 changes: 29 additions & 1 deletion trunk/net/xfrm/xfrm_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
struct xfrm_policy *pol, **p;
struct xfrm_policy *delpol = NULL;
struct xfrm_policy **newpos = NULL;
struct dst_entry *gc_list;

write_lock_bh(&xfrm_policy_lock);
for (p = &xfrm_policy_list[dir]; (pol=*p)!=NULL;) {
Expand Down Expand Up @@ -381,9 +382,36 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
xfrm_pol_hold(policy);
write_unlock_bh(&xfrm_policy_lock);

if (delpol) {
if (delpol)
xfrm_policy_kill(delpol);

read_lock_bh(&xfrm_policy_lock);
gc_list = NULL;
for (policy = policy->next; policy; policy = policy->next) {
struct dst_entry *dst;

write_lock(&policy->lock);
dst = policy->bundles;
if (dst) {
struct dst_entry *tail = dst;
while (tail->next)
tail = tail->next;
tail->next = gc_list;
gc_list = dst;

policy->bundles = NULL;
}
write_unlock(&policy->lock);
}
read_unlock_bh(&xfrm_policy_lock);

while (gc_list) {
struct dst_entry *dst = gc_list;

gc_list = dst->next;
dst_free(dst);
}

return 0;
}
EXPORT_SYMBOL(xfrm_policy_insert);
Expand Down

0 comments on commit 48bee0e

Please sign in to comment.