if (nf_flow_state_check(flow, iph->protocol, skb, thoff))
                return NF_ACCEPT;
 
-       flow_offload_refresh(flow_table, flow);
-
        if (!dst_check(&rt->dst, 0)) {
                flow_offload_teardown(flow);
                return NF_ACCEPT;
        if (skb_try_make_writable(skb, thoff + hdrsize))
                return NF_DROP;
 
+       flow_offload_refresh(flow_table, flow);
+
        iph = ip_hdr(skb);
        nf_flow_nat_ip(flow, skb, thoff, dir, iph);
 
                                sizeof(*ip6h)))
                return NF_ACCEPT;
 
-       flow_offload_refresh(flow_table, flow);
-
        if (!dst_check(&rt->dst, 0)) {
                flow_offload_teardown(flow);
                return NF_ACCEPT;
        if (skb_try_make_writable(skb, sizeof(*ip6h) + hdrsize))
                return NF_DROP;
 
+       flow_offload_refresh(flow_table, flow);
+
        ip6h = ipv6_hdr(skb);
        nf_flow_nat_ipv6(flow, skb, dir, ip6h);