[ovs-dev] [PATCH 18/31] fixup: Fix locking in netdev-native-tnl.

Jan Scheurich jan.scheurich at ericsson.com
Wed Jun 14 22:49:10 UTC 2017


OK

> -----Original Message-----
> From: ovs-dev-bounces at openvswitch.org [mailto:ovs-dev-bounces at openvswitch.org] On Behalf Of Ben Pfaff
> Sent: Tuesday, 13 June, 2017 00:29
> To: dev at openvswitch.org
> Cc: Ben Pfaff <blp at ovn.org>
> Subject: [ovs-dev] [PATCH 18/31] fixup: Fix locking in netdev-native-tnl.
> 
> Locks weren't always released on error paths.
> 
> Signed-off-by: Ben Pfaff <blp at ovn.org>
> ---
>  lib/netdev-native-tnl.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c
> index 658c871015f9..515b9948cabb 100644
> --- a/lib/netdev-native-tnl.c
> +++ b/lib/netdev-native-tnl.c
> @@ -468,6 +468,7 @@ netdev_gre_build_header(const struct netdev *netdev,
>      } else if (pt_ns(params->flow->packet_type) == OFPHTN_ETHERTYPE) {
>          greh->protocol = pt_ns_type_be(params->flow->packet_type);
>      } else {
> +        ovs_mutex_unlock(&dev->mutex);
>          return 1;
>      }
>      greh->flags = 0;
> @@ -591,12 +592,10 @@ netdev_vxlan_build_header(const struct netdev *netdev,
>                  vxh->vx_gpe.next_protocol = VXLAN_GPE_NP_ETHERNET;
>                  break;
>              default:
> -                /* Drop packet. */
> -                return 1;
> -                break;
> +                goto drop;
>              }
>          } else {
> -            return 1;
> +            goto drop;
>          }
>      } else {
>          put_16aligned_be32(&vxh->vx_flags, htonl(VXLAN_FLAGS));
> @@ -608,6 +607,10 @@ netdev_vxlan_build_header(const struct netdev *netdev,
>      data->header_len += sizeof *vxh;
>      data->tnl_type = OVS_VPORT_TYPE_VXLAN;
>      return 0;
> +
> +drop:
> +    ovs_mutex_unlock(&dev->mutex);
> +    return 1;
>  }
> 
>  struct dp_packet *
> --
> 2.10.2
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev


More information about the dev mailing list