]> git.baikalelectronics.ru Git - kernel.git/commit
net_sched: fix a resource leak in tcindex_set_parms()
authorCong Wang <xiyou.wangcong@gmail.com>
Tue, 4 Feb 2020 19:10:12 +0000 (11:10 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 5 Feb 2020 13:11:57 +0000 (14:11 +0100)
commita899cfaad711f78698ea570d85a411678f82279c
tree701c31838708e8147ed62ee53c15b17df0aad781
parentabac5e95692545376f87ae6ab326393e8f655ef8
net_sched: fix a resource leak in tcindex_set_parms()

Jakub noticed there is a potential resource leak in
tcindex_set_parms(): when tcindex_filter_result_init() fails
and it jumps to 'errout1' which doesn't release the memory
and resources allocated by tcindex_alloc_perfect_hash().

We should just jump to 'errout_alloc' which calls
tcindex_free_perfect_hash().

Fixes: 6a2fa3446e17 ("net_sched: properly handle failure case of tcf_exts_init()")
Reported-by: Jakub Kicinski <kuba@kernel.org>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_tcindex.c