diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 78fcbb89cf32..b8b4843f9c6d 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -932,7 +932,8 @@ int xfrm_state_flush(struct net *net, u8 proto, bool task_valid) restart: hlist_for_each_entry(x, net->xfrm.state_bydst+i, bydst) { if (!xfrm_state_kern(x) && - xfrm_id_proto_match(x->id.proto, proto)) { + xfrm_id_proto_match(x->id.proto, proto) && + x->km.state != XFRM_STATE_DEAD) { xfrm_state_hold(x); spin_unlock_bh(&net->xfrm.xfrm_state_lock);