net/sched: fix error recovery in qdisc_create()
authorEric Dumazet <edumazet@google.com>
Fri, 10 Feb 2023 15:26:05 +0000 (15:26 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 13 Feb 2023 09:51:59 +0000 (09:51 +0000)
commit4fab64126891d413f207dacd5762a839b3470315
treeeebe29982fa76498709eacf4c22ac0808d5bbdb2
parentcafc3662ee3fe29a0027e0a947e6c6493cccaf60
net/sched: fix error recovery in qdisc_create()

If TCA_STAB attribute is malformed, qdisc_get_stab() returns
an error, and we end up calling ops->destroy() while ops->init()
has not been called yet.

While we are at it, call qdisc_put_stab() after ops->destroy().

Fixes: 1f62879e3632 ("net/sched: make stab available before ops->init() call")
Reported-by: syzbot+d44d88f1d11e6ca8576b@syzkaller.appspotmail.com
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: Kurt Kanzenbach <kurt@linutronix.de>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_api.c