diff options
author | Cy Schubert <cy@FreeBSD.org> | 2019-08-28 04:55:03 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2019-08-28 04:55:03 +0000 |
commit | d49ffa766460fd6e1c736c03cc516d3b22decfc4 (patch) | |
tree | b5ceb816db7644d92fb185b502b9bd664e97841c /sys/contrib/ipfilter/netinet | |
parent | 6d7534d8ea62ff4c4cb71986608896049f35f8bb (diff) | |
download | src-d49ffa766460fd6e1c736c03cc516d3b22decfc4.tar.gz src-d49ffa766460fd6e1c736c03cc516d3b22decfc4.zip |
Destroy the mutex in case of error.
Obtained from: NetBSD ip_nat.c r1.7
MFC after: 3 days
Notes
Notes:
svn path=/head/; revision=351562
Diffstat (limited to 'sys/contrib/ipfilter/netinet')
-rw-r--r-- | sys/contrib/ipfilter/netinet/ip_nat.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/contrib/ipfilter/netinet/ip_nat.c b/sys/contrib/ipfilter/netinet/ip_nat.c index b814665b45d7..e2de7eade5df 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat.c +++ b/sys/contrib/ipfilter/netinet/ip_nat.c @@ -3078,7 +3078,7 @@ ipf_nat_newrdr(fin, nat, ni) /* creating a new NAT structure for a "RDR" rule (incoming NAT translation) */ /* and (3) building that structure and putting it into the NAT table(s). */ /* */ -/* NOTE: natsave should NOT be used top point back to an ipstate_t struct */ +/* NOTE: natsave should NOT be used to point back to an ipstate_t struct */ /* as it can result in memory being corrupted. */ /* ------------------------------------------------------------------------ */ nat_t * @@ -3406,6 +3406,7 @@ ipf_nat_insert(softc, softn, nat) u_int hv0, hv1; u_int sp, dp; ipnat_t *in; + int ret; /* * Try and return an error as early as possible, so calculate the hash @@ -3488,7 +3489,10 @@ ipf_nat_insert(softc, softn, nat) nat->nat_mtu[1] = GETIFMTU_4(nat->nat_ifps[1]); } - return ipf_nat_hashtab_add(softc, softn, nat); + ret = ipf_nat_hashtab_add(softc, softn, nat); + if (ret == -1) + MUTEX_DESTROY(&nat->nat_lock); + return ret; } |