]> git.ipfire.org Git - people/arne_f/kernel.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:56 +0000 (09:15 +0200)
commitc5161c689e816e1d134801c771ae304aa842c620
treeda29d487e6fd3adeb3fc0ce362248dc1bc298999
parent8fd403fc2a8ef3edf27468075029030d92663d51
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