--- x/net/xfrm/xfrm_state.c +++ y/net/xfrm/xfrm_state.c @@ -615,6 +615,8 @@ static void xfrm_state_gc_destroy(struct put_page(x->xfrag.page); xfrm_dev_state_free(x); security_xfrm_state_free(x); + x->km.state++; + xfrm_state_delete(x); xfrm_state_free(x); } @@ -816,7 +818,11 @@ int __xfrm_state_delete(struct xfrm_stat x->km.state = XFRM_STATE_DEAD; spin_lock(&net->xfrm.xfrm_state_lock); - list_del(&x->km.all); + if (list_empty(&x->km.all)) { + spin_unlock(&net->xfrm.xfrm_state_lock); + return 0; + } + list_del_init(&x->km.all); hlist_del_rcu(&x->bydst); hlist_del_rcu(&x->bysrc); if (x->km.seq)