Patch "net/sched: act_sample: fix action bind logic" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net/sched: act_sample: fix action bind logic

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-sched-act_sample-fix-action-bind-logic.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 5b0993f3a9629c82e254a5ecca54fc7473e57382
Author: Pedro Tammela <pctammela@xxxxxxxxxxxx>
Date:   Fri Feb 24 12:00:58 2023 -0300

    net/sched: act_sample: fix action bind logic
    
    [ Upstream commit 4a20056a49a1854966562241922f68197f950539 ]
    
    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@xxxxxxxxxxxx>
    Signed-off-by: Pedro Tammela <pctammela@xxxxxxxxxxxx>
    Reviewed-by: Simon Horman <simon.horman@xxxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
index 214f4efdd9920..909a685b91621 100644
--- a/net/sched/act_sample.c
+++ b/net/sched/act_sample.c
@@ -54,8 +54,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]);
@@ -79,6 +79,13 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
 		tcf_idr_release(*a, bind);
 		return -EEXIST;
 	}
+
+	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;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux