diff options
author | Xiyu Yang <xiyuyang19@fudan.edu.cn> | 2021-08-29 23:58:01 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-09-15 09:50:45 +0200 |
commit | f96bc82e0348be15def7b98ebfd6e276d2c1e8a1 (patch) | |
tree | 0856d35373db8859815846c9f9f7c148ea1b11e9 | |
parent | 5867e20e1808acd0c832ddea2587e5ee49813874 (diff) | |
download | linux-stable-f96bc82e0348be15def7b98ebfd6e276d2c1e8a1.tar.gz linux-stable-f96bc82e0348be15def7b98ebfd6e276d2c1e8a1.tar.bz2 linux-stable-f96bc82e0348be15def7b98ebfd6e276d2c1e8a1.zip |
net: sched: Fix qdisc_rate_table refcount leak when get tcf_block failed
[ Upstream commit c66070125837900163b81a03063ddd657a7e9bfb ]
The reference counting issue happens in one exception handling path of
cbq_change_class(). When failing to get tcf_block, the function forgets
to decrease the refcount of "rtab" increased by qdisc_put_rtab(),
causing a refcount leak.
Fix this issue by jumping to "failure" label when get tcf_block failed.
Fixes: 6529eaba33f0 ("net: sched: introduce tcf block infractructure")
Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Reviewed-by: Cong Wang <cong.wang@bytedance.com>
Link: https://lore.kernel.org/r/1630252681-71588-1-git-send-email-xiyuyang19@fudan.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | net/sched/sch_cbq.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 53d45e029c36..4a78fcf5d4f9 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c @@ -1614,7 +1614,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t err = tcf_block_get(&cl->block, &cl->filter_list, sch, extack); if (err) { kfree(cl); - return err; + goto failure; } if (tca[TCA_RATE]) { |