mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-24 11:25:43 +00:00
[PATCH] Do not hold state lock while checking size
This patch from Herbert Xu fixes a deadlock with IPsec. When an ICMP frag. required is sent and the ICMP message needs the same SA as the packet that caused it the state will be locked twice. [IPSEC]: Do not hold state lock while checking size. This can elicit ICMP message output and thus result in a deadlock. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Chris Wright <chrisw@osdl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
82e59799aa
commit
92ef2364e6
2 changed files with 12 additions and 12 deletions
|
@ -103,17 +103,17 @@ int xfrm4_output(struct sk_buff *skb)
|
|||
goto error_nolock;
|
||||
}
|
||||
|
||||
if (x->props.mode) {
|
||||
err = xfrm4_tunnel_check_size(skb);
|
||||
if (err)
|
||||
goto error_nolock;
|
||||
}
|
||||
|
||||
spin_lock_bh(&x->lock);
|
||||
err = xfrm_state_check(x, skb);
|
||||
if (err)
|
||||
goto error;
|
||||
|
||||
if (x->props.mode) {
|
||||
err = xfrm4_tunnel_check_size(skb);
|
||||
if (err)
|
||||
goto error;
|
||||
}
|
||||
|
||||
xfrm4_encap(skb);
|
||||
|
||||
err = x->type->output(skb);
|
||||
|
|
|
@ -103,17 +103,17 @@ int xfrm6_output(struct sk_buff *skb)
|
|||
goto error_nolock;
|
||||
}
|
||||
|
||||
if (x->props.mode) {
|
||||
err = xfrm6_tunnel_check_size(skb);
|
||||
if (err)
|
||||
goto error_nolock;
|
||||
}
|
||||
|
||||
spin_lock_bh(&x->lock);
|
||||
err = xfrm_state_check(x, skb);
|
||||
if (err)
|
||||
goto error;
|
||||
|
||||
if (x->props.mode) {
|
||||
err = xfrm6_tunnel_check_size(skb);
|
||||
if (err)
|
||||
goto error;
|
||||
}
|
||||
|
||||
xfrm6_encap(skb);
|
||||
|
||||
err = x->type->output(skb);
|
||||
|
|
Loading…
Reference in a new issue