提交 b12d1fc0 编写于 作者: Y YueHaibing 提交者: Xie XiuQi

net/sched: cbs: Fix error path of cbs_module_init

mainline inclusion
from mainline-v5.2-rc7
commit 45d5cb13
category: bugfix
bugzilla: 16960
CVE: NA

-------------------------------------

If register_qdisc fails, we should unregister
netdevice notifier.
Reported-by: NHulk Robot <hulkci@huawei.com>
Fixes: e0a7683d ("net/sched: cbs: fix port_rate miscalculation")
Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: Nguodeqing <geffrey.guo@huawei.com>
Reviewed-by: NWenan Mao <maowenan@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 8aa429d6
...@@ -553,12 +553,17 @@ static struct notifier_block cbs_device_notifier = { ...@@ -553,12 +553,17 @@ static struct notifier_block cbs_device_notifier = {
static int __init cbs_module_init(void) static int __init cbs_module_init(void)
{ {
int err = register_netdevice_notifier(&cbs_device_notifier); int err;
err = register_netdevice_notifier(&cbs_device_notifier);
if (err) if (err)
return err; return err;
return register_qdisc(&cbs_qdisc_ops); err = register_qdisc(&cbs_qdisc_ops);
if (err)
unregister_netdevice_notifier(&cbs_device_notifier);
return err;
} }
static void __exit cbs_module_exit(void) static void __exit cbs_module_exit(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册