]> 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:16:48 +0000 (09:16 +0200)
commitf1a315ca06be80dddab380c7af1ddace3ee5f110
tree34a1b9a92e6f70fb09a9f801f4250f9ee5b5af7f
parent481c8a89e89a373b8f157ac2b0df6cee07e2bbfb
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