PM / devfreq: stopping the governor before device_unregister()
authorVincent Donnefort <vincent.donnefort@arm.com>
Mon, 3 Sep 2018 00:02:07 +0000 (09:02 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Tue, 2 Oct 2018 01:16:41 +0000 (10:16 +0900)
commit2f061fd0c2d852e32e03a903fccd810663c5c31e
tree9cd1724ec2a4cf6aeb03d1e56c65d6fa371588d3
parentf037eb8c1f476bc903d99695c1eb9f99ccb46b27
PM / devfreq: stopping the governor before device_unregister()

device_release() is freeing the resources before calling the device
specific release callback which is, in the case of devfreq, stopping
the governor.

It is a problem as some governors are using the device resources. e.g.
simpleondemand which is using the devfreq deferrable monitoring work. If it
is not stopped before the resources are freed, it might lead to a use after
free.

Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>
Reviewed-by: John Einar Reitan <john.reitan@arm.com>
[cw00.choi: Fix merge conflict]
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
drivers/devfreq/devfreq.c