add missing lb_put_writer_lock() to lb_vip_add() invalid args cases 47/12747/2
authorAndrey "Zed" Zaikin <zed.0xff@gmail.com>
Fri, 25 May 2018 15:09:58 +0000 (18:09 +0300)
committerDamjan Marion <dmarion.lists@gmail.com>
Mon, 28 May 2018 15:02:30 +0000 (15:02 +0000)
Change-Id: I9343672c5765a5a4cb56c99fa5de176ddcac62c7
Signed-off-by: Andrey "Zed" Zaikin <zed.0xff@gmail.com>
src/plugins/lb/lb.c

index e1d4df5..d5dc305 100644 (file)
@@ -845,17 +845,22 @@ int lb_vip_add(lb_vip_add_args_t args, u32 *vip_index)
       (type != LB_VIP_TYPE_IP4_GRE4) &&
       (type != LB_VIP_TYPE_IP4_GRE6) &&
       (type != LB_VIP_TYPE_IP4_L3DSR) &&
-      (type != LB_VIP_TYPE_IP4_NAT4))
+      (type != LB_VIP_TYPE_IP4_NAT4)) {
+    lb_put_writer_lock();
     return VNET_API_ERROR_INVALID_ADDRESS_FAMILY;
+  }
 
   if ((!ip46_prefix_is_ip4(&(args.prefix), args.plen)) &&
       (type != LB_VIP_TYPE_IP6_GRE4) &&
       (type != LB_VIP_TYPE_IP6_GRE6) &&
-      (type != LB_VIP_TYPE_IP6_NAT6))
+      (type != LB_VIP_TYPE_IP6_NAT6)) {
+    lb_put_writer_lock();
     return VNET_API_ERROR_INVALID_ADDRESS_FAMILY;
+  }
 
   if ((type == LB_VIP_TYPE_IP4_L3DSR) && (args.encap_args.dscp >= 64 ) )
     {
+      lb_put_writer_lock();
       return VNET_API_ERROR_VALUE_EXIST;
     }