Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193915
b: refs/heads/master
c: ea2dea9
h: refs/heads/master
i:
  193913: 3fd4fd8
  193911: ea0ec72
v: v3
  • Loading branch information
Timo Teräs authored and David S. Miller committed Apr 2, 2010
1 parent 3afb3d5 commit 897d05e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 28 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: c8bf4d04f970fafb3430d332533e1cf103f2a018
refs/heads/master: ea2dea9dacc256fe927857feb423872051642ae7
31 changes: 9 additions & 22 deletions trunk/net/xfrm/xfrm_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static void xfrm_policy_timer(unsigned long data)

read_lock(&xp->lock);

if (xp->walk.dead)
if (unlikely(xp->walk.dead))
goto out;

dir = xfrm_policy_id2dir(xp->index);
Expand Down Expand Up @@ -297,17 +297,7 @@ static DECLARE_WORK(xfrm_policy_gc_work, xfrm_policy_gc_task);

static void xfrm_policy_kill(struct xfrm_policy *policy)
{
int dead;

write_lock_bh(&policy->lock);
dead = policy->walk.dead;
policy->walk.dead = 1;
write_unlock_bh(&policy->lock);

if (unlikely(dead)) {
WARN_ON(1);
return;
}

spin_lock_bh(&xfrm_policy_gc_lock);
hlist_add_head(&policy->bydst, &xfrm_policy_gc_list);
Expand Down Expand Up @@ -776,7 +766,6 @@ xfrm_policy_flush_secctx_check(struct net *net, u8 type, struct xfrm_audit *audi
int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info)
{
int dir, err = 0, cnt = 0;
struct xfrm_policy *dp;

write_lock_bh(&xfrm_policy_lock);

Expand All @@ -794,10 +783,9 @@ int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info)
&net->xfrm.policy_inexact[dir], bydst) {
if (pol->type != type)
continue;
dp = __xfrm_policy_unlink(pol, dir);
__xfrm_policy_unlink(pol, dir);
write_unlock_bh(&xfrm_policy_lock);
if (dp)
cnt++;
cnt++;

xfrm_audit_policy_delete(pol, 1, audit_info->loginuid,
audit_info->sessionid,
Expand All @@ -816,10 +804,9 @@ int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info)
bydst) {
if (pol->type != type)
continue;
dp = __xfrm_policy_unlink(pol, dir);
__xfrm_policy_unlink(pol, dir);
write_unlock_bh(&xfrm_policy_lock);
if (dp)
cnt++;
cnt++;

xfrm_audit_policy_delete(pol, 1,
audit_info->loginuid,
Expand Down Expand Up @@ -1132,6 +1119,9 @@ int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol)
__xfrm_policy_link(pol, XFRM_POLICY_MAX+dir);
}
if (old_pol)
/* Unlinking succeeds always. This is the only function
* allowed to delete or replace socket policy.
*/
__xfrm_policy_unlink(old_pol, XFRM_POLICY_MAX+dir);
write_unlock_bh(&xfrm_policy_lock);

Expand Down Expand Up @@ -1737,11 +1727,8 @@ int __xfrm_lookup(struct net *net, struct dst_entry **dst_p, struct flowi *fl,
goto error;
}

for (pi = 0; pi < npols; pi++) {
read_lock_bh(&pols[pi]->lock);
for (pi = 0; pi < npols; pi++)
pol_dead |= pols[pi]->walk.dead;
read_unlock_bh(&pols[pi]->lock);
}

write_lock_bh(&policy->lock);
if (unlikely(pol_dead || stale_bundle(dst))) {
Expand Down
6 changes: 1 addition & 5 deletions trunk/net/xfrm/xfrm_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -1770,13 +1770,9 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
if (xp == NULL)
return -ENOENT;

read_lock(&xp->lock);
if (xp->walk.dead) {
read_unlock(&xp->lock);
if (unlikely(xp->walk.dead))
goto out;
}

read_unlock(&xp->lock);
err = 0;
if (up->hard) {
uid_t loginuid = NETLINK_CB(skb).loginuid;
Expand Down

0 comments on commit 897d05e

Please sign in to comment.