diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c index 19cafae748ab..73f49dc41157 100644 --- a/net/netfilter/nf_flow_table_ip.c +++ b/net/netfilter/nf_flow_table_ip.c @@ -873,7 +873,8 @@ static int nf_flow_queue_xmit4(struct sk_buff *skb, return NF_DROP; } neigh = ip_neigh_gw4(rt->dst.dev, rt_nexthop(rt, ip_addr->ip)); - if (IS_ERR(neigh)) { + if (IS_ERR(neigh) || + !(READ_ONCE(neigh->nud_state) & NUD_VALID)) { flow_offload_teardown(flow); return NF_DROP; } @@ -1202,7 +1203,8 @@ static int nf_flow_queue_xmit6(struct sk_buff *skb, return NF_DROP; } neigh = ip_neigh_gw6(rt->dst.dev, rt6_nexthop(rt, &ip_addr->in6)); - if (IS_ERR(neigh)) { + if (IS_ERR(neigh) || + !(READ_ONCE(neigh->nud_state) & NUD_VALID)) { flow_offload_teardown(flow); return NF_DROP; }