act_mirred: Fix mirred_init_module error handling

[ Upstream commit 11c9a7d38af524217efb7a176ad322b97ac2f163 ]

If tcf_register_action failed, mirred_device_notifier
should be unregistered.

Fixes: 3b87956ea6 ("net sched: fix race in mirred device removal")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
YueHaibing 2019-10-09 11:10:52 +08:00 committed by Greg Kroah-Hartman
parent e4bf36f1e6
commit 5c1b003d22

View file

@ -445,7 +445,11 @@ static int __init mirred_init_module(void)
return err;
pr_info("Mirror/redirect action on\n");
return tcf_register_action(&act_mirred_ops, &mirred_net_ops);
err = tcf_register_action(&act_mirred_ops, &mirred_net_ops);
if (err)
unregister_netdevice_notifier(&mirred_device_notifier);
return err;
}
static void __exit mirred_cleanup_module(void)