Skip to content

Commit f96bc82

Browse files
sherllygregkh
authored andcommitted
net: sched: Fix qdisc_rate_table refcount leak when get tcf_block failed
[ Upstream commit c660701 ] 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: 6529eab ("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>
1 parent 5867e20 commit f96bc82

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/sched/sch_cbq.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
16141614
err = tcf_block_get(&cl->block, &cl->filter_list, sch, extack);
16151615
if (err) {
16161616
kfree(cl);
1617-
return err;
1617+
goto failure;
16181618
}
16191619

16201620
if (tca[TCA_RATE]) {

0 commit comments

Comments
 (0)