thermal: int3403_thermal: Fix NULL pointer deref on module load / probe
authorHans de Goede <hdegoede@redhat.com>
Sun, 22 Apr 2018 17:56:17 +0000 (19:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Jun 2018 19:02:47 +0000 (04:02 +0900)
commitb1d0907c6feddcfe13f26b901d7e28c22d6650c0
tree67bb8c263e39112e2dfa9fd29a39b43fba25ee49
parent56dfe52e04a287eb8c1d25d8fcfaef9e32fcd2e8
thermal: int3403_thermal: Fix NULL pointer deref on module load / probe

[ Upstream commit 13b86f50eaaddaea4bdd2fe476fd12e6a0951add ]

Starting with kernel 4.17 thermal_cooling_device_register() will call the
get_max_state() op during register.

Since we deref priv->priv in int3403_get_max_state() this means we must
set priv->priv before calling thermal_cooling_device_register().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/thermal/int340x_thermal/int3403_thermal.c