summaryrefslogtreecommitdiffstats
path: root/net/can
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2017-12-02 21:44:07 +0100
committerDavid S. Miller <davem@davemloft.net>2017-12-04 11:32:39 -0500
commitc1c502b511503ee5de55382744859b622411f32b (patch)
treeb31562756414fd0d71b934e232e91a62bfb59e33 /net/can
parente4202511480da5f8e6870d8f6ecbb821aeaa8caf (diff)
downloadlinux-0-day-c1c502b511503ee5de55382744859b622411f32b.tar.gz
linux-0-day-c1c502b511503ee5de55382744859b622411f32b.tar.xz
net: use rtnl_register_module where needed
all of these can be compiled as a module, so use new _module version to make sure module can no longer be removed while callback/dump is in use. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/can')
-rw-r--r--net/can/gw.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/net/can/gw.c b/net/can/gw.c
index 73a02af4b5d76..398dd0395ad99 100644
--- a/net/can/gw.c
+++ b/net/can/gw.c
@@ -1014,6 +1014,8 @@ static struct pernet_operations cangw_pernet_ops = {
static __init int cgw_module_init(void)
{
+ int ret;
+
/* sanitize given module parameter */
max_hops = clamp_t(unsigned int, max_hops, CGW_MIN_HOPS, CGW_MAX_HOPS);
@@ -1031,15 +1033,19 @@ static __init int cgw_module_init(void)
notifier.notifier_call = cgw_notifier;
register_netdevice_notifier(&notifier);
- if (__rtnl_register(PF_CAN, RTM_GETROUTE, NULL, cgw_dump_jobs, 0)) {
+ ret = rtnl_register_module(THIS_MODULE, PF_CAN, RTM_GETROUTE,
+ NULL, cgw_dump_jobs, 0);
+ if (ret) {
unregister_netdevice_notifier(&notifier);
kmem_cache_destroy(cgw_cache);
return -ENOBUFS;
}
- /* Only the first call to __rtnl_register can fail */
- __rtnl_register(PF_CAN, RTM_NEWROUTE, cgw_create_job, NULL, 0);
- __rtnl_register(PF_CAN, RTM_DELROUTE, cgw_remove_job, NULL, 0);
+ /* Only the first call to rtnl_register_module can fail */
+ rtnl_register_module(THIS_MODULE, PF_CAN, RTM_NEWROUTE,
+ cgw_create_job, NULL, 0);
+ rtnl_register_module(THIS_MODULE, PF_CAN, RTM_DELROUTE,
+ cgw_remove_job, NULL, 0);
return 0;
}