Commit 45d5cb13 authored by YueHaibing's avatar YueHaibing Committed by David S. Miller

net/sched: cbs: Fix error path of cbs_module_init

If register_qdisc fails, we should unregister
netdevice notifier.
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Fixes: e0a7683d ("net/sched: cbs: fix port_rate miscalculation")
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c492d4c7
...@@ -549,12 +549,17 @@ static struct notifier_block cbs_device_notifier = { ...@@ -549,12 +549,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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment