mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
xfrm: Fix unlink race when policies are deleted.
When a policy is unlinked from the lists in thread context, the xfrm timer can fire before we can mark this policy as dead. So reinitialize the bydst hlist, then hlist_unhashed() will notice that this policy is not linked and will avoid a doulble unlink of that policy. Reported-by: Xianpeng Zhao <673321875@qq.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
This commit is contained in:
parent
ee5c23176f
commit
3a9016f97f
1 changed files with 1 additions and 1 deletions
|
@ -1158,7 +1158,7 @@ static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
|
|||
if (hlist_unhashed(&pol->bydst))
|
||||
return NULL;
|
||||
|
||||
hlist_del(&pol->bydst);
|
||||
hlist_del_init(&pol->bydst);
|
||||
hlist_del(&pol->byidx);
|
||||
list_del(&pol->walk.all);
|
||||
net->xfrm.policy_count[dir]--;
|
||||
|
|
Loading…
Reference in a new issue