Skip to content

Commit

Permalink
netfilter: nf_nat: Fix return NF_DROP in nfnetlink_parse_nat_setup
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
gfreewind authored and ummakynes committed Apr 15, 2017
1 parent a702ece commit 7025bac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/netfilter/nf_nat_core.c
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 7025bac

Please sign in to comment.