Merge branch 'for-3.7/core' of git://git.kernel.dk/linux-block
[firefly-linux-kernel-4.4.55.git] / net / netfilter / nf_nat_core.c
index 1816ad381485621ed5d68ff938662636478128fa..5f2f9109f4615e3dc1fa510c5136d10bfa20fba8 100644 (file)
@@ -201,10 +201,8 @@ find_appropriate_src(struct net *net, u16 zone,
                                       &ct->tuplehash[IP_CT_DIR_REPLY].tuple);
                        result->dst = tuple->dst;
 
-                       if (in_range(l3proto, l4proto, result, range)) {
-                               rcu_read_unlock();
+                       if (in_range(l3proto, l4proto, result, range))
                                return 1;
-                       }
                }
        }
        return 0;
@@ -481,6 +479,8 @@ static int nf_nat_proto_clean(struct nf_conn *i, void *data)
 
        if (!nat)
                return 0;
+       if (!(i->status & IPS_SRC_NAT_DONE))
+               return 0;
        if ((clean->l3proto && nf_ct_l3num(i) != clean->l3proto) ||
            (clean->l4proto && nf_ct_protonum(i) != clean->l4proto))
                return 0;