• Vlad Buslov's avatar
    net: sched: don't use tc_action->order during action dump · bfcfd6a4
    Vlad Buslov authored
    [ Upstream commit 4097e9d2 ]
    
    Function tcf_action_dump() relies on tc_action->order field when starting
    nested nla to send action data to userspace. This approach breaks in
    several cases:
    
    - When multiple filters point to same shared action, tc_action->order field
      is overwritten each time it is attached to filter. This causes filter
      dump to output action with incorrect attribute for all filters that have
      the action in different position (different order) from the last set
      tc_action->order value.
    
    - When action data is displayed using tc action API (RTM_GETACTION), action
      order is overwritten by tca_action_gd() according to its position in
      resulting array of nl attributes, which will break filter dump for all
      filters attached to that shared action that expect it to have different
      order value.
    
    Don't rely on tc_action->order when dumping actions. Set nla according to
    action position in resulting array of actions instead.
    Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
    Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    bfcfd6a4
act_api.c 36.2 KB