aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2010-06-24 17:35:00 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-24 17:35:00 -0400
commitb1312c89f0016f778cac4f1536f1434e132f8713 (patch)
tree6cec9bc88430cf30f8409b8b607d2b6a6d2fd118 /net
parent38000a94a902e94ca8b5498f7871c6316de8957a (diff)
xfrm: check bundle policy existance before dereferencing it
Fix the bundle validation code to not assume having a valid policy. When we have multiple transformations for a xfrm policy, the bundle instance will be a chain of bundles with only the first one having the policy reference. When policy_genid is bumped it will expire the first bundle in the chain which is equivalent of expiring the whole chain. Reported-bisected-and-tested-by: Justin P. Mattock <justinmattock@gmail.com> Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/xfrm/xfrm_policy.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 4bf27d901333..af1c173be4ad 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2300,7 +2300,8 @@ int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *first,
2300 return 0; 2300 return 0;
2301 if (xdst->xfrm_genid != dst->xfrm->genid) 2301 if (xdst->xfrm_genid != dst->xfrm->genid)
2302 return 0; 2302 return 0;
2303 if (xdst->policy_genid != atomic_read(&xdst->pols[0]->genid)) 2303 if (xdst->num_pols > 0 &&
2304 xdst->policy_genid != atomic_read(&xdst->pols[0]->genid))
2304 return 0; 2305 return 0;
2305 2306
2306 if (strict && fl && 2307 if (strict && fl &&