diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2014-11-24 14:24:18 +0900 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-11-26 11:32:32 +0100 |
commit | 97cd6805acf0d6b1b06b439cbc8c25586d73dcfc (patch) | |
tree | eb9984611dcdf7f751c24479d8f88d740de4ba45 /drivers/scsi/ufs | |
parent | e8cb64db81e8c88c5c824ca74c2e57b4c6919ca6 (diff) | |
download | blackbird-obmc-linux-97cd6805acf0d6b1b06b439cbc8c25586d73dcfc.tar.gz blackbird-obmc-linux-97cd6805acf0d6b1b06b439cbc8c25586d73dcfc.zip |
ufs: ensure clk gating work is finished before module unloading
When dynamic clk gating feature is enabled, delayed workqueue machanism
is used in order to detect certain period of inactivity. But there is no
guarantee that scheduled gating work is completed before module unloading.
So it can cause kernel crash by accessing memory after it was freed.
Fix it by cancelling clk gating and ungating works and ensure that its
execution is finished before module unloading.
Signed-off-by: Akinobu Mita <mita@fixstars.com>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/ufs')
-rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index b9da4463cefb..61bf002c7bd1 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -744,6 +744,8 @@ static void ufshcd_exit_clk_gating(struct ufs_hba *hba) if (!ufshcd_is_clkgating_allowed(hba)) return; device_remove_file(hba->dev, &hba->clk_gating.delay_attr); + cancel_work_sync(&hba->clk_gating.ungate_work); + cancel_delayed_work_sync(&hba->clk_gating.gate_work); } /* Must be called with host lock acquired */ |