]> git.baikalelectronics.ru Git - kernel.git/commit
thermal/of: Fix potential uninitialized value access
authorPeng Fan <peng.fan@nxp.com>
Wed, 19 Jul 2023 01:16:36 +0000 (09:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:42:29 +0000 (09:42 +0200)
commit7da6250d29675335a4cd5f0fbacb23cb54420ea0
tree3ac3b1df4e09a1645fb1677712f3ee0de27ee4d2
parent7c70932568068b1396f20c27b43275c4915cb21b
thermal/of: Fix potential uninitialized value access

[ Upstream commit f96801f0cfcefc0a16b146596577c53c75ee9773 ]

If of_parse_phandle_with_args() called from __thermal_of_bind() or
__thermal_of_unbind() fails, cooling_spec.np will not be initialized,
so move the of_node_put() calls below the respective return value checks
to avoid dereferencing an uninitialized pointer.

Fixes: 3fd6d6e2b4e8 ("thermal/of: Rework the thermal device tree initialization")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/thermal/thermal_of.c