diff options
Diffstat (limited to 'net/xfrm/xfrm_state.c')
-rw-r--r-- | net/xfrm/xfrm_state.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 0021aad5db43..be02bd981d12 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -367,7 +367,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
367 | */ | 367 | */ |
368 | if (x->km.state == XFRM_STATE_VALID) { | 368 | if (x->km.state == XFRM_STATE_VALID) { |
369 | if (!xfrm_selector_match(&x->sel, fl, family) || | 369 | if (!xfrm_selector_match(&x->sel, fl, family) || |
370 | !xfrm_sec_ctx_match(pol->security, x->security)) | 370 | !security_xfrm_state_pol_flow_match(x, pol, fl)) |
371 | continue; | 371 | continue; |
372 | if (!best || | 372 | if (!best || |
373 | best->km.dying > x->km.dying || | 373 | best->km.dying > x->km.dying || |
@@ -379,7 +379,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
379 | } else if (x->km.state == XFRM_STATE_ERROR || | 379 | } else if (x->km.state == XFRM_STATE_ERROR || |
380 | x->km.state == XFRM_STATE_EXPIRED) { | 380 | x->km.state == XFRM_STATE_EXPIRED) { |
381 | if (xfrm_selector_match(&x->sel, fl, family) && | 381 | if (xfrm_selector_match(&x->sel, fl, family) && |
382 | xfrm_sec_ctx_match(pol->security, x->security)) | 382 | security_xfrm_state_pol_flow_match(x, pol, fl)) |
383 | error = -ESRCH; | 383 | error = -ESRCH; |
384 | } | 384 | } |
385 | } | 385 | } |
@@ -403,6 +403,14 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
403 | * to current session. */ | 403 | * to current session. */ |
404 | xfrm_init_tempsel(x, fl, tmpl, daddr, saddr, family); | 404 | xfrm_init_tempsel(x, fl, tmpl, daddr, saddr, family); |
405 | 405 | ||
406 | error = security_xfrm_state_alloc_acquire(x, pol->security, fl->secid); | ||
407 | if (error) { | ||
408 | x->km.state = XFRM_STATE_DEAD; | ||
409 | xfrm_state_put(x); | ||
410 | x = NULL; | ||
411 | goto out; | ||
412 | } | ||
413 | |||
406 | if (km_query(x, tmpl, pol) == 0) { | 414 | if (km_query(x, tmpl, pol) == 0) { |
407 | x->km.state = XFRM_STATE_ACQ; | 415 | x->km.state = XFRM_STATE_ACQ; |
408 | list_add_tail(&x->bydst, xfrm_state_bydst+h); | 416 | list_add_tail(&x->bydst, xfrm_state_bydst+h); |