Skip to content

net/sched: forbid 'goto_chain' on fallback actions

Davide Caratti netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4net/sched: act_gact: disallow 'goto chain' on fallback control actionnet/sched/act_gact.c+5 -02 replies
2/4net/sched: act_police: disallow 'goto chain' on fallback control actionnet/sched/act_police.c+10 -22 replies
3/4tc-tests: test denial of 'goto chain' on 'random' traffic in gact.jsontools/testing/selftests/tc-testing/tc-tests/actions/gact.json+24 -00 replies
4/4tc-tests: test denial of 'goto chain' for exceed traffic in police.jsontools/testing/selftests/tc-testing/tc-tests/actions/police.json+24 -00 replies

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchCong WangJamal Hadi SalimJiri Pirko
SeriesA-b
1/4A-b A-b
2/4A-b A-b
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH net 0/4] net/sched: forbid 'goto_chain' on fallback actions

the following command:

 # tc actions add action police rate 1mbit burst 1k conform-exceed \
Quoted 1 line

pass / goto chain 42

generates a NULL pointer dereference when packets exceed the configured rate. Similarly, the following command:

 # tc actions add action pass random determ goto chain 42 2

makes the kernel crash with NULL dereference when the first packet does not match the 'pass' action.

gact and police allow users to specify a fallback control action, that is stored in the action private data. 'goto chain x' never worked for these cases, since a->goto_chain handle was never initialized. There is only one goto_chain handle per TC action, and it is designed to be non-NULL only if tcf_action contains a 'goto chain' command. So, let's forbid 'goto chain' on fallback actions.

Patch 1/4 and 2/4 change the .init() functions of police and gact, to let them return an error when users try to set 'goto chain x' in the fallback action. Patch 3/4 and 4/4 add TDC selftest coverage to this new behavior.

Davide Caratti (4):
net/sched: act_gact: disallow 'goto chain' on fallback control action net/sched: act_police: disallow 'goto chain' on fallback control
action
tc-tests: test denial of 'goto chain' on 'random' traffic in gact.json
tc-tests: test denial of 'goto chain' for exceed traffic in
police.json

 net/sched/act_gact.c                          |  5 ++++
 net/sched/act_police.c                        | 12 ++++++++--
 .../tc-testing/tc-tests/actions/gact.json     | 24 +++++++++++++++++++
 .../tc-testing/tc-tests/actions/police.json   | 24 +++++++++++++++++++
 4 files changed, 63 insertions(+), 2 deletions(-)
Signature · 1 line
2.17.1