Skip to content

Commit 3a9016f

Browse files
committed
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>
1 parent ee5c231 commit 3a9016f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/xfrm/xfrm_policy.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@ static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
11581158
if (hlist_unhashed(&pol->bydst))
11591159
return NULL;
11601160

1161-
hlist_del(&pol->bydst);
1161+
hlist_del_init(&pol->bydst);
11621162
hlist_del(&pol->byidx);
11631163
list_del(&pol->walk.all);
11641164
net->xfrm.policy_count[dir]--;

0 commit comments

Comments
 (0)