]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
thermal: bcm2835: Fix crash in bcm2835_thermal_debugfs
authorPhil Elwell <phil@raspberrypi.org>
Tue, 29 Jan 2019 09:55:57 +0000 (09:55 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Apr 2019 07:15:01 +0000 (09:15 +0200)
commit6aa84e8a9fcba8aee8a1437bb4ab134cdc256d4a
tree6eb913cbdcb97425103d4b233b56cd39fa16b4a9
parent643deb59cee632f326f1865dc3b5ea8e91ff8c35
thermal: bcm2835: Fix crash in bcm2835_thermal_debugfs

[ Upstream commit 35122495a8c6683e863acf7b05a7036b2be64c7a ]

"cat /sys/kernel/debug/bcm2835_thermal/regset" causes a NULL pointer
dereference in bcm2835_thermal_debugfs. The driver makes use of the
implementation details of the thermal framework to retrieve a pointer
to its private data from a struct thermal_zone_device, and gets it
wrong - leading to the crash. Instead, store its private data as the
drvdata and retrieve the thermal_zone_device pointer from it.

Fixes: bcb7dd9ef206 ("thermal: bcm2835: add thermal driver for bcm2835 SoC")
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/thermal/broadcom/bcm2835_thermal.c