Skip to content

Commit c0f47c2

Browse files
ozshlomodavem330
authored andcommitted
net/sched: cls_api: Fix flow action initialization
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: c54e1d9 ("flow_offload: add ops to tc_action_ops for flow action setup") Signed-off-by: Oz Shlomo <[email protected]> Reviewed-by: Roi Dayan <[email protected]> ---- v1 -> v2: - coalese the generic flow action fields initialization to a single loop Reviewed-by: Baowen Zheng <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3b15b3e commit c0f47c2

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

net/sched/cls_api.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3533,7 +3533,7 @@ int tc_setup_action(struct flow_action *flow_action,
35333533
struct tc_action *actions[],
35343534
struct netlink_ext_ack *extack)
35353535
{
3536-
int i, j, index, err = 0;
3536+
int i, j, k, index, err = 0;
35373537
struct tc_action *act;
35383538

35393539
BUILD_BUG_ON(TCA_ACT_HW_STATS_ANY != FLOW_ACTION_HW_STATS_ANY);
@@ -3553,14 +3553,18 @@ int tc_setup_action(struct flow_action *flow_action,
35533553
if (err)
35543554
goto err_out_locked;
35553555

3556-
entry->hw_stats = tc_act_hw_stats(act->hw_stats);
3557-
entry->hw_index = act->tcfa_index;
35583556
index = 0;
35593557
err = tc_setup_offload_act(act, entry, &index, extack);
3560-
if (!err)
3561-
j += index;
3562-
else
3558+
if (err)
35633559
goto err_out_locked;
3560+
3561+
for (k = 0; k < index ; k++) {
3562+
entry[k].hw_stats = tc_act_hw_stats(act->hw_stats);
3563+
entry[k].hw_index = act->tcfa_index;
3564+
}
3565+
3566+
j += index;
3567+
35643568
spin_unlock_bh(&act->tcfa_lock);
35653569
}
35663570

0 commit comments

Comments
 (0)