From d2a89b52839597c70746d9f46a21b1aab0a26c02 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Fri, 17 Jul 2020 18:42:16 +0200 Subject: thermal: netlink: Improve the initcall ordering The initcalls like to play joke. In our case, the thermal-netlink initcall is called after the thermal-core initcall but this one sends a notification before the former is initialized. No issue was spotted, but it could lead to a memory corruption, so instead of relying on the core_initcall for the thermal-netlink, let's initialize directly from the thermal-core init routine, so we have full control of the init ordering. Reported-by: Marek Szyprowski Signed-off-by: Daniel Lezcano Tested-by: Marek Szyprowski Reviewed-by: Amit Kucheria Link: https://lore.kernel.org/r/20200717164217.18819-1-daniel.lezcano@linaro.org --- drivers/thermal/thermal_netlink.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/thermal/thermal_netlink.c') diff --git a/drivers/thermal/thermal_netlink.c b/drivers/thermal/thermal_netlink.c index 9299e7975f31..af7b2383e8f6 100644 --- a/drivers/thermal/thermal_netlink.c +++ b/drivers/thermal/thermal_netlink.c @@ -641,8 +641,7 @@ static struct genl_family thermal_gnl_family __ro_after_init = { .n_mcgrps = ARRAY_SIZE(thermal_genl_mcgrps), }; -static int __init thermal_netlink_init(void) +int __init thermal_netlink_init(void) { return genl_register_family(&thermal_gnl_family); } -core_initcall(thermal_netlink_init); -- cgit v1.2.3