Commit fba1111a authored by Herbert Xu's avatar Herbert Xu Committed by Thomas Graf

[IPSEC]: Do not hold state lock while checking size.

This can elicit ICMP message output and thus result in a
deadlock.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0172d20e
...@@ -103,17 +103,17 @@ int xfrm4_output(struct sk_buff *skb) ...@@ -103,17 +103,17 @@ int xfrm4_output(struct sk_buff *skb)
goto error_nolock; goto error_nolock;
} }
spin_lock_bh(&x->lock);
err = xfrm_state_check(x, skb);
if (err)
goto error;
if (x->props.mode) { if (x->props.mode) {
err = xfrm4_tunnel_check_size(skb); err = xfrm4_tunnel_check_size(skb);
if (err) if (err)
goto error; goto error_nolock;
} }
spin_lock_bh(&x->lock);
err = xfrm_state_check(x, skb);
if (err)
goto error;
xfrm4_encap(skb); xfrm4_encap(skb);
err = x->type->output(x, skb); err = x->type->output(x, skb);
......
...@@ -103,17 +103,17 @@ int xfrm6_output(struct sk_buff *skb) ...@@ -103,17 +103,17 @@ int xfrm6_output(struct sk_buff *skb)
goto error_nolock; goto error_nolock;
} }
spin_lock_bh(&x->lock);
err = xfrm_state_check(x, skb);
if (err)
goto error;
if (x->props.mode) { if (x->props.mode) {
err = xfrm6_tunnel_check_size(skb); err = xfrm6_tunnel_check_size(skb);
if (err) if (err)
goto error; goto error_nolock;
} }
spin_lock_bh(&x->lock);
err = xfrm_state_check(x, skb);
if (err)
goto error;
xfrm6_encap(skb); xfrm6_encap(skb);
err = x->type->output(x, skb); err = x->type->output(x, skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment