aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2019-06-21 21:44:37 +0800
committerDavid S. Miller <davem@davemloft.net>2019-06-23 11:32:48 -0700
commit45d5cb137c3638b3a310f41b31d8e79daf647f14 (patch)
tree901d596057160e17b659edff88d14919b255902a /net
parentc492d4c74dd3f87559883ffa0f94a8f1ae3fe5f5 (diff)
downloadtip-45d5cb137c3638b3a310f41b31d8e79daf647f14.tar.gz
tip-45d5cb137c3638b3a310f41b31d8e79daf647f14.tar.xz
tip-45d5cb137c3638b3a310f41b31d8e79daf647f14.zip
net/sched: cbs: Fix error path of cbs_module_init
If register_qdisc fails, we should unregister netdevice notifier. Reported-by: Hulk Robot <hulkci@huawei.com> Fixes: e0a7683d30e9 ("net/sched: cbs: fix port_rate miscalculation") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/sched/sch_cbs.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/sched/sch_cbs.c b/net/sched/sch_cbs.c
index e16a3d37d2bc..732e109c3055 100644
--- a/net/sched/sch_cbs.c
+++ b/net/sched/sch_cbs.c
@@ -549,12 +549,17 @@ static struct notifier_block cbs_device_notifier = {
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)
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)