OSDN Git Service

PM / devfreq: Lock devfreq in trans_stat_show
authorLeonard Crestez <leonard.crestez@nxp.com>
Tue, 24 Sep 2019 07:52:23 +0000 (10:52 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Dec 2019 19:35:03 +0000 (20:35 +0100)
commitb1d06da38497b017739a4837b34122aa44f56d90
treefa39a77dd26a79ca625bed8bca62594bd3b87691
parent1fce7e81b94baf07af77e2c0a7f6736b3719897a
PM / devfreq: Lock devfreq in trans_stat_show

commit 2abb0d5268ae7b5ddf82099b1f8d5aa8414637d4 upstream.

There is no locking in this sysfs show function so stats printing can
race with a devfreq_update_status called as part of freq switching or
with initialization.

Also add an assert in devfreq_update_status to make it clear that lock
must be held by caller.

Fixes: 39688ce6facd ("PM / devfreq: account suspend/resume for stats")
Cc: stable@vger.kernel.org
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/devfreq/devfreq.c