From: Simon Horman <simon.horman@corigine.com>
To: Pedro Tammela <pctammela@mojatatu.com>
Cc: netdev@vger.kernel.org, jhs@mojatatu.com,
xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
amir@vadai.me, dcaratti@redhat.com, willemb@google.com,
simon.horman@netronome.com, john.hurley@netronome.com,
yotamg@mellanox.com, ozsh@nvidia.com, paulb@nvidia.com
Subject: Re: [PATCH net 3/3] net/sched: act_sample: fix action bind logic
Date: Sat, 25 Feb 2023 17:20:36 +0100 [thread overview]
Message-ID: <Y/o1VJLEwPJWsxZv@corigine.com> (raw)
In-Reply-To: <20230224150058.149505-4-pctammela@mojatatu.com>
On Fri, Feb 24, 2023 at 12:00:58PM -0300, Pedro Tammela wrote:
> The TC architecture allows filters and actions to be created independently.
> In filters the user can reference action objects using:
> tc action add action sample ... index 1
> tc filter add ... action pedit index 1
>
> In the current code for act_sample this is broken as it checks netlink
> attributes for create/update before actually checking if we are binding to an
> existing action.
>
> tdc results:
> 1..29
> ok 1 9784 - Add valid sample action with mandatory arguments
> ok 2 5c91 - Add valid sample action with mandatory arguments and continue control action
> ok 3 334b - Add valid sample action with mandatory arguments and drop control action
> ok 4 da69 - Add valid sample action with mandatory arguments and reclassify control action
> ok 5 13ce - Add valid sample action with mandatory arguments and pipe control action
> ok 6 1886 - Add valid sample action with mandatory arguments and jump control action
> ok 7 7571 - Add sample action with invalid rate
> ok 8 b6d4 - Add sample action with mandatory arguments and invalid control action
> ok 9 a874 - Add invalid sample action without mandatory arguments
> ok 10 ac01 - Add invalid sample action without mandatory argument rate
> ok 11 4203 - Add invalid sample action without mandatory argument group
> ok 12 14a7 - Add invalid sample action without mandatory argument group
> ok 13 8f2e - Add valid sample action with trunc argument
> ok 14 45f8 - Add sample action with maximum rate argument
> ok 15 ad0c - Add sample action with maximum trunc argument
> ok 16 83a9 - Add sample action with maximum group argument
> ok 17 ed27 - Add sample action with invalid rate argument
> ok 18 2eae - Add sample action with invalid group argument
> ok 19 6ff3 - Add sample action with invalid trunc size
> ok 20 2b2a - Add sample action with invalid index
> ok 21 dee2 - Add sample action with maximum allowed index
> ok 22 560e - Add sample action with cookie
> ok 23 704a - Replace existing sample action with new rate argument
> ok 24 60eb - Replace existing sample action with new group argument
> ok 25 2cce - Replace existing sample action with new trunc argument
> ok 26 59d1 - Replace existing sample action with new control argument
> ok 27 0a6e - Replace sample action with invalid goto chain control
> ok 28 3872 - Delete sample action with valid index
> ok 29 a394 - Delete sample action with invalid index
>
> Fixes: 5c5670fae430 ("net/sched: Introduce sample tc action")
> Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
I have a minor comment below.
But in the context of this series, this patch looks good to me.
Reviewed-by: Simon Horman <simon.horman@corigine.com>
> ---
> net/sched/act_sample.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
> index f7416b5598e0..4c670e7568dc 100644
> --- a/net/sched/act_sample.c
> +++ b/net/sched/act_sample.c
> @@ -55,8 +55,8 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
> sample_policy, NULL);
> if (ret < 0)
> return ret;
> - if (!tb[TCA_SAMPLE_PARMS] || !tb[TCA_SAMPLE_RATE] ||
> - !tb[TCA_SAMPLE_PSAMPLE_GROUP])
> +
> + if (!tb[TCA_SAMPLE_PARMS])
> return -EINVAL;
>
> parm = nla_data(tb[TCA_SAMPLE_PARMS]);
> @@ -80,6 +80,13 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
> tcf_idr_release(*a, bind);
> return -EEXIST;
nit: not for this patch, but I think it would be more consistent
to use goto release_idr here.
> }
> +
> + if (!tb[TCA_SAMPLE_RATE] || !tb[TCA_SAMPLE_PSAMPLE_GROUP]) {
> + NL_SET_ERR_MSG(extack, "sample rate and group are required");
> + err = -EINVAL;
> + goto release_idr;
> + }
> +
> err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack);
> if (err < 0)
> goto release_idr;
> --
> 2.34.1
>
prev parent reply other threads:[~2023-02-25 16:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-24 15:00 [PATCH net 0/3] net/sched: fix action bind logic Pedro Tammela
2023-02-24 15:00 ` [PATCH net 1/3] net/sched: act_pedit: " Pedro Tammela
2023-02-25 13:08 ` Simon Horman
2023-02-25 13:38 ` Pedro Tammela
2023-02-25 16:15 ` Simon Horman
2023-02-27 19:36 ` Jakub Kicinski
2023-02-27 19:51 ` Jamal Hadi Salim
2023-02-27 20:04 ` Jakub Kicinski
2023-02-27 21:41 ` Jakub Kicinski
2023-02-27 21:47 ` Jamal Hadi Salim
2023-02-24 15:00 ` [PATCH net 2/3] net/sched: act_mpls: " Pedro Tammela
2023-02-25 16:17 ` Simon Horman
2023-02-24 15:00 ` [PATCH net 3/3] net/sched: act_sample: " Pedro Tammela
2023-02-25 16:20 ` Simon Horman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y/o1VJLEwPJWsxZv@corigine.com \
--to=simon.horman@corigine.com \
--cc=amir@vadai.me \
--cc=davem@davemloft.net \
--cc=dcaratti@redhat.com \
--cc=edumazet@google.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=john.hurley@netronome.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ozsh@nvidia.com \
--cc=pabeni@redhat.com \
--cc=paulb@nvidia.com \
--cc=pctammela@mojatatu.com \
--cc=simon.horman@netronome.com \
--cc=willemb@google.com \
--cc=xiyou.wangcong@gmail.com \
--cc=yotamg@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.