]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: sched: Fix one possible panic when no destroy callback
authorGao Feng <gfree.wind@vip.163.com>
Wed, 28 Jun 2017 04:53:54 +0000 (12:53 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Jul 2017 05:00:06 +0000 (07:00 +0200)
commit3f4715e60e1d93b8ce952a3e4127008bfd58a4f8
treec4eb0c47063486149b88d3a810bfd16936ec9278
parent378345d61fca426c0b7c3f604c14dafb67895f40
net: sched: Fix one possible panic when no destroy callback

[ Upstream commit c1a4872ebfb83b1af7144f7b29ac8c4b344a12a8 ]

When qdisc fail to init, qdisc_create would invoke the destroy callback
to cleanup. But there is no check if the callback exists really. So it
would cause the panic if there is no real destroy callback like the qdisc
codel, fq, and so on.

Take codel as an example following:
When a malicious user constructs one invalid netlink msg, it would cause
codel_init->codel_change->nla_parse_nested failed.
Then kernel would invoke the destroy callback directly but qdisc codel
doesn't define one. It causes one panic as a result.

Now add one the check for destroy to avoid the possible panic.

Fixes: 87b60cfacf9f ("net_sched: fix error recovery at qdisc creation")
Signed-off-by: Gao Feng <gfree.wind@vip.163.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sched/sch_api.c