netfilter: nf_nat: Fix return NF_DROP in nfnetlink_parse_nat_setup
authorGao Feng <fgao@ikuai8.com>
Wed, 12 Apr 2017 10:33:03 +0000 (18:33 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 15 Apr 2017 09:04:14 +0000 (11:04 +0200)
The __nf_nat_alloc_null_binding invokes nf_nat_setup_info which may
return NF_DROP when memory is exhausted, so convert NF_DROP to -ENOMEM
to make ctnetlink happy. Or ctnetlink_setup_nat treats it as a success
when one error NF_DROP happens actully.

Signed-off-by: Gao Feng <fgao@ikuai8.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_nat_core.c

index fb0e654117859e99d36d8070bdc690936971b658..5e35643da6508d55937a2229ee39aa311852a4ec 100644 (file)
@@ -806,7 +806,7 @@ nfnetlink_parse_nat_setup(struct nf_conn *ct,
 
        /* No NAT information has been passed, allocate the null-binding */
        if (attr == NULL)
-               return __nf_nat_alloc_null_binding(ct, manip);
+               return __nf_nat_alloc_null_binding(ct, manip) == NF_DROP ? -ENOMEM : 0;
 
        err = nfnetlink_parse_nat(attr, ct, &range, l3proto);
        if (err < 0)