diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2020-07-17 18:42:16 +0200 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2020-07-21 10:40:08 +0200 |
commit | d2a89b52839597c70746d9f46a21b1aab0a26c02 (patch) | |
tree | 9c28571810343e1be5edba1f88f223d82cc34305 /drivers/thermal/thermal_netlink.h | |
parent | c62e7ac395641a764639b1c6635955f02b8d9d16 (diff) | |
download | linux-stable-d2a89b52839597c70746d9f46a21b1aab0a26c02.tar.gz linux-stable-d2a89b52839597c70746d9f46a21b1aab0a26c02.tar.bz2 linux-stable-d2a89b52839597c70746d9f46a21b1aab0a26c02.zip |
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 <m.szyprowski@samsung.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>
Link: https://lore.kernel.org/r/20200717164217.18819-1-daniel.lezcano@linaro.org
Diffstat (limited to 'drivers/thermal/thermal_netlink.h')
-rw-r--r-- | drivers/thermal/thermal_netlink.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/thermal/thermal_netlink.h b/drivers/thermal/thermal_netlink.h index 0ec28d105da5..828d1dddfa98 100644 --- a/drivers/thermal/thermal_netlink.h +++ b/drivers/thermal/thermal_netlink.h @@ -6,6 +6,7 @@ /* Netlink notification function */ #ifdef CONFIG_THERMAL_NETLINK +int __init thermal_netlink_init(void); int thermal_notify_tz_create(int tz_id, const char *name); int thermal_notify_tz_delete(int tz_id); int thermal_notify_tz_enable(int tz_id); @@ -23,6 +24,11 @@ int thermal_notify_cdev_delete(int cdev_id); int thermal_notify_tz_gov_change(int tz_id, const char *name); int thermal_genl_sampling_temp(int id, int temp); #else +static inline int thermal_netlink_init(void) +{ + return 0; +} + static inline int thermal_notify_tz_create(int tz_id, const char *name) { return 0; |