summaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorDavide Caratti <dcaratti@redhat.com>2018-03-19 15:31:23 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-30 07:52:18 +0200
commit154040a5a869af2ef1f78f828a35ea03772e3da0 (patch)
tree14577e0858847063140bddf95a27910d8297373b /net/sched
parent29e36c3099fc2e3064068508ced39a702d1815b9 (diff)
downloadlinux-stable-154040a5a869af2ef1f78f828a35ea03772e3da0.tar.gz
linux-stable-154040a5a869af2ef1f78f828a35ea03772e3da0.tar.bz2
linux-stable-154040a5a869af2ef1f78f828a35ea03772e3da0.zip
net/sched: fix idr leak in the error path of tcf_simp_init()
[ Upstream commit 60e10b3adc3bac0f6a894c28e0eb1f2d13607362 ] if the kernel fails to duplicate 'sdata', creation of a new action fails with -ENOMEM. However, subsequent attempts to install the same action using the same value of 'index' systematically fail with -ENOSPC, and that value of 'index' will no more be usable by act_simple, until rmmod / insmod of act_simple.ko is done: # tc actions add action simple sdata hello index 100 # tc actions list action simple action order 0: Simple <hello> index 100 ref 1 bind 0 # tc actions flush action simple # tc actions add action simple sdata hello index 100 RTNETLINK answers: Cannot allocate memory We have an error talking to the kernel # tc actions flush action simple # tc actions add action simple sdata hello index 100 RTNETLINK answers: No space left on device We have an error talking to the kernel # tc actions add action simple sdata hello index 100 RTNETLINK answers: No space left on device We have an error talking to the kernel ... Fix this in the error path of tcf_simp_init(), calling tcf_idr_release() in place of tcf_idr_cleanup(). Fixes: 65a206c01e8e ("net/sched: Change act_api and act_xxx modules to use IDR") Suggested-by: Cong Wang <xiyou.wangcong@gmail.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: Davide Caratti <dcaratti@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/act_simple.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
index e7b57e5071a3..b5f80e675783 100644
--- a/net/sched/act_simple.c
+++ b/net/sched/act_simple.c
@@ -121,7 +121,7 @@ static int tcf_simp_init(struct net *net, struct nlattr *nla,
d = to_defact(*a);
ret = alloc_defdata(d, defdata);
if (ret < 0) {
- tcf_idr_cleanup(*a, est);
+ tcf_idr_release(*a, bind);
return ret;
}
d->tcf_action = parm->action;