]> git.baikalelectronics.ru Git - kernel.git/commit
net_sched: fix a memory leak in atm_tc_init()
authorCong Wang <xiyou.wangcong@gmail.com>
Thu, 9 Jul 2020 03:13:59 +0000 (20:13 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 9 Jul 2020 19:31:28 +0000 (12:31 -0700)
commit1accc7103c3cd7d417d201d44498a4311f727711
treed28155bb389847c2f3821f7a759895c7b65be460
parentef2a7c5020dc83b5d37cddb40fa999372e0926e7
net_sched: fix a memory leak in atm_tc_init()

When tcf_block_get() fails inside atm_tc_init(),
atm_tc_put() is called to release the qdisc p->link.q.
But the flow->ref prevents it to do so, as the flow->ref
is still zero.

Fix this by moving the p->link.ref initialization before
tcf_block_get().

Fixes: 78fe3c434b13 ("net: sched: introduce tcf block infractructure")
Reported-and-tested-by: syzbot+d411cff6ab29cc2c311b@syzkaller.appspotmail.com
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/sch_atm.c