summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOz Shlomo <ozsh@nvidia.com>2022-07-19 15:24:09 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-07-29 18:28:13 +0300
commitb47ade56ac52ba05db7249bf6e05d2ee09de4daa (patch)
treeca53e9566edb5ef9d0239189ad57c5b76ee320b3
parent46deb91ac8a790286ad6d24cf92e7ab0ab2582bb (diff)
downloadlinux-b47ade56ac52ba05db7249bf6e05d2ee09de4daa.tar.xz
net/sched: cls_api: Fix flow action initialization
[ Upstream commit c0f47c2822aadeb8b2829f3e4c3792f184c7be33 ] The cited commit refactored the flow action initialization sequence to use an interface method when translating tc action instances to flow offload objects. The refactored version skips the initialization of the generic flow action attributes for tc actions, such as pedit, that allocate more than one offload entry. This can cause potential issues for drivers mapping flow action ids. Populate the generic flow action fields for all the flow action entries. Fixes: c54e1d920f04 ("flow_offload: add ops to tc_action_ops for flow action setup") Signed-off-by: Oz Shlomo <ozsh@nvidia.com> Reviewed-by: Roi Dayan <roid@nvidia.com> ---- v1 -> v2: - coalese the generic flow action fields initialization to a single loop Reviewed-by: Baowen Zheng <baowen.zheng@corigine.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--net/sched/cls_api.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 2d4dc1468a9a..6fd33c75d6bb 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -3531,7 +3531,7 @@ int tc_setup_action(struct flow_action *flow_action,
struct tc_action *actions[],
struct netlink_ext_ack *extack)
{
- int i, j, index, err = 0;
+ int i, j, k, index, err = 0;
struct tc_action *act;
BUILD_BUG_ON(TCA_ACT_HW_STATS_ANY != FLOW_ACTION_HW_STATS_ANY);
@@ -3551,14 +3551,18 @@ int tc_setup_action(struct flow_action *flow_action,
if (err)
goto err_out_locked;
- entry->hw_stats = tc_act_hw_stats(act->hw_stats);
- entry->hw_index = act->tcfa_index;
index = 0;
err = tc_setup_offload_act(act, entry, &index, extack);
- if (!err)
- j += index;
- else
+ if (err)
goto err_out_locked;
+
+ for (k = 0; k < index ; k++) {
+ entry[k].hw_stats = tc_act_hw_stats(act->hw_stats);
+ entry[k].hw_index = act->tcfa_index;
+ }
+
+ j += index;
+
spin_unlock_bh(&act->tcfa_lock);
}