Commit a2db90b0 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

[IPSEC]: Fix state modifications in xfrm_state_update().

doing a mod_timer on a live state without holding a lock or for that
matter not even checking whether the state is dead is definitely a bad
idea
parent e98db349
......@@ -489,15 +489,16 @@ int xfrm_state_update(struct xfrm_state *x)
memcpy(x1->encap, x->encap, sizeof(*x1->encap));
memcpy(&x1->lft, &x->lft, sizeof(x1->lft));
x1->km.dying = 0;
err = 0;
}
spin_unlock_bh(&x1->lock);
if (!mod_timer(&x1->timer, jiffies + HZ))
xfrm_state_hold(x1);
if (x1->curlft.use_time)
xfrm_state_check_expire(x1);
err = 0;
}
spin_unlock_bh(&x1->lock);
xfrm_state_put(x1);
return err;
......
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