[ovs-dev] [PATCH] datapath: Fix exposing OVS_TUNNEL_KEY_ATTR_GTPU_OPTS to kernel module.

Gregory Rose gvrose8192 at gmail.com
Thu Oct 8 15:11:57 UTC 2020


On 10/8/2020 6:53 AM, Ilya Maximets wrote:
> Kernel module doesn't know about GTPU and it should return correct
> out-of-range error in case this tunnel attribute passed there for
> any reason.  Current out-of-tree module will pass the range check
> and will try to access ovs_tunnel_key_lens[] array by index
> OVS_TUNNEL_KEY_ATTR_GTPU_OPTS.  Even though it might not produce
> issues in current code, this is not a good thing to do since
> ovs_tunnel_key_lens[] array is not explicitly initialized for
> OVS_TUNNEL_KEY_ATTR_GTPU_OPTS and we will likely have misleading
> error about incorrect attribute length in the end.
> 
> Fixes: 3c6d05a02e0f ("userspace: Add GTP-U support.")
> Signed-off-by: Ilya Maximets <i.maximets at ovn.org>
> ---
>   datapath/linux/compat/include/linux/openvswitch.h | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/datapath/linux/compat/include/linux/openvswitch.h b/datapath/linux/compat/include/linux/openvswitch.h
> index cc41bbea4..2d884312f 100644
> --- a/datapath/linux/compat/include/linux/openvswitch.h
> +++ b/datapath/linux/compat/include/linux/openvswitch.h
> @@ -405,7 +405,10 @@ enum ovs_tunnel_key_attr {
>   	OVS_TUNNEL_KEY_ATTR_IPV6_DST,		/* struct in6_addr dst IPv6 address. */
>   	OVS_TUNNEL_KEY_ATTR_PAD,
>   	OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS,	/* struct erspan_metadata */
> +#ifndef __KERNEL__
> +	/* Only used within userspace data path. */
>   	OVS_TUNNEL_KEY_ATTR_GTPU_OPTS,		/* struct gtpu_metadata */
> +#endif
>   	__OVS_TUNNEL_KEY_ATTR_MAX
>   };
>   
> 

If it's not used by the kernel then I agree, let's not expose it.

Acked-by: Greg Rose <gvrose8192 at gmail.com>


More information about the dev mailing list