aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/cnat/cnat_src_policy.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/cnat/cnat_src_policy.c b/src/plugins/cnat/cnat_src_policy.c
index e11e912ab15..cac24b7742c 100644
--- a/src/plugins/cnat/cnat_src_policy.c
+++ b/src/plugins/cnat/cnat_src_policy.c
@@ -122,7 +122,10 @@ cnat_allocate_port (u16 * port, ip_protocol_t iproto)
if (PREDICT_FALSE (*port >= UINT16_MAX))
*port = clib_bitmap_next_clear (ca->bmap, MIN_SRC_PORT);
if (PREDICT_FALSE (*port >= UINT16_MAX))
- return -1;
+ {
+ clib_spinlock_unlock (&ca->lock);
+ return -1;
+ }
}
clib_bitmap_set_no_check (ca->bmap, *port, 1);
*port = clib_host_to_net_u16 (*port);