[ovs-dev] [PATCH] tc: Fix using uninitialized id chain.

Roi Dayan roid at mellanox.com
Sun Jan 5 09:25:58 UTC 2020



On 2020-01-03 8:48 PM, Ilya Maximets wrote:
> tc_make_tcf_id() doesn't initialize the 'chain' field leaving it with a
> random value from the stack.  This makes request_from_tcf_id() create
> request with random TCA_CHAIN included.  These requests are obviously
> doesn't work as needed leading to broken flow dump and various other
> issues.  Fix that by using designated initializer instead.
> 
> Fixes: acdd544c4c9a ("tc: Introduce tcf_id to specify a tc filter")
> Signed-off-by: Ilya Maximets <i.maximets at ovn.org>
> ---
>  lib/tc.h | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/tc.h b/lib/tc.h
> index 70e7f38d2..d31c0953e 100644
> --- a/lib/tc.h
> +++ b/lib/tc.h
> @@ -271,13 +271,12 @@ static inline struct tcf_id
>  tc_make_tcf_id(int ifindex, uint32_t block_id, uint16_t prio,
>                 enum tc_qdisc_hook hook)
>  {
> -    struct tcf_id id;
> -
> -    id.block_id = block_id;
> -    id.ifindex = ifindex;
> -    id.prio = prio;
> -    id.hook = hook;
> -    id.handle = 0;
> +    struct tcf_id id = {
> +        .hook = hook,
> +        .block_id = block_id,
> +        .ifindex = ifindex,
> +        .prio = prio,
> +    };
>  
>      return id;
>  }
> 

Acked-by: Roi Dayan <roid at mellanox.com>

thanks!


More information about the dev mailing list