summaryrefslogtreecommitdiffstats
path: root/net/sched/act_ctinfo.c
diff options
context:
space:
mode:
authorKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>2019-06-17 11:03:26 +0100
committerDavid S. Miller <davem@davemloft.net>2019-06-17 14:00:30 -0700
commita658c2e49f02eedafd3e1b6e30a8a9b173d7248b (patch)
tree6c9a4e04804da8597aeef15ee0e4c455de230b6f /net/sched/act_ctinfo.c
parent098eadce3c622c07b328d0a43dda379b38cf7c5e (diff)
downloadlinux-a658c2e49f02eedafd3e1b6e30a8a9b173d7248b.tar.bz2
net: sched: act_ctinfo: fix action creation
Use correct return value on action creation: ACT_P_CREATED. The use of incorrect return value could result in a situation where the system thought a ctinfo module was listening but actually wasn't instantiated correctly leading to an OOPS in tcf_generic_walker(). Confession time: Until very recently, development of this module has been done on 'net-next' tree to 'clean compile' level with run-time testing on backports to 4.14 & 4.19 kernels under openwrt. During the back & forward porting during development & testing, the critical ACT_P_CREATED return code got missed despite being in the 4.14 & 4.19 backports. I have now gone through the init functions, using act_csum as reference with a fine toothed comb. Bonus, no more OOPSes. I managed to also miss this issue till now due to the new strict nla_parse_nested function failing validation before action creation. As an inexperienced developer I've learned that copy/pasting/backporting/forward porting code correctly is hard. If I ever get to a developer conference I shall don the cone of shame. Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_ctinfo.c')
-rw-r--r--net/sched/act_ctinfo.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/sched/act_ctinfo.c b/net/sched/act_ctinfo.c
index a7d3679d7e2e..2c17f6843107 100644
--- a/net/sched/act_ctinfo.c
+++ b/net/sched/act_ctinfo.c
@@ -213,6 +213,7 @@ static int tcf_ctinfo_init(struct net *net, struct nlattr *nla,
tcf_idr_cleanup(tn, actparm->index);
return ret;
}
+ ret = ACT_P_CREATED;
} else if (err > 0) {
if (bind) /* don't override defaults */
return 0;