Skip to content

Commit

Permalink
Merge branch 'net-lan966x-flower-validate-control-flags'
Browse files Browse the repository at this point in the history
Asbjørn Sloth Tønnesen says:

====================
net: lan966x: flower: validate control flags

This series adds flower control flags validation to the
lan966x driver, and changes it from assuming that it handles
all control flags, to instead reject rules if they have
masked any unknown/unsupported control flags.

v1: https://lore.kernel.org/netdev/20240423102720.228728-1-ast@fiberby.net/
====================

Link: https://lore.kernel.org/r/20240424125347.461995-1-ast@fiberby.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
kuba-moo committed Apr 26, 2024
2 parents df65494 + 8c65e27 commit 3c4d790
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions drivers/net/ethernet/microchip/lan966x/lan966x_tc_flower.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ static bool lan966x_tc_is_known_etype(struct vcap_tc_flower_parse_usage *st,
static int
lan966x_tc_flower_handler_control_usage(struct vcap_tc_flower_parse_usage *st)
{
struct netlink_ext_ack *extack = st->fco->common.extack;
struct flow_match_control match;
int err = 0;

Expand All @@ -59,7 +60,7 @@ lan966x_tc_flower_handler_control_usage(struct vcap_tc_flower_parse_usage *st)
VCAP_KF_L3_FRAGMENT,
VCAP_BIT_0);
if (err)
goto out;
goto bad_frag_out;
}

if (match.mask->flags & FLOW_DIS_FIRST_FRAG) {
Expand All @@ -72,15 +73,20 @@ lan966x_tc_flower_handler_control_usage(struct vcap_tc_flower_parse_usage *st)
VCAP_KF_L3_FRAG_OFS_GT0,
VCAP_BIT_1);
if (err)
goto out;
goto bad_frag_out;
}

if (!flow_rule_is_supp_control_flags(FLOW_DIS_IS_FRAGMENT |
FLOW_DIS_FIRST_FRAG,
match.mask->flags, extack))
return -EOPNOTSUPP;

st->used_keys |= BIT_ULL(FLOW_DISSECTOR_KEY_CONTROL);

return err;

out:
NL_SET_ERR_MSG_MOD(st->fco->common.extack, "ip_frag parse error");
bad_frag_out:
NL_SET_ERR_MSG_MOD(extack, "ip_frag parse error");
return err;
}

Expand Down

0 comments on commit 3c4d790

Please sign in to comment.