]> git.baikalelectronics.ru Git - kernel.git/commit
net: sched: fix memleak for chain zero
authorJiri Pirko <jiri@mellanox.com>
Wed, 6 Sep 2017 11:14:19 +0000 (13:14 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Sep 2017 02:17:20 +0000 (19:17 -0700)
commit2f78e1d502581135ca2818c5caccc11020698b9d
tree86a70c65cfa532a6653dfc24e8c54bcd0789d14f
parent1fd4570fcaaff604c0e3bb731e47fac703d6a4ad
net: sched: fix memleak for chain zero

There's a memleak happening for chain 0. The thing is, chain 0 needs to
be always present, not created on demand. Therefore tcf_block_get upon
creation of block calls the tcf_chain_create function directly. The
chain is created with refcnt == 1, which is not correct in this case and
causes the memleak. So move the refcnt increment into tcf_chain_get
function even for the case when chain needs to be created.

Reported-by: Jakub Kicinski <kubakici@wp.pl>
Fixes: 271fce5a6e27 ("net: sched: introduce multichain support for filters")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Tested-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_api.c