Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Akinobu Mita and committed by
Christoph Hellwig
97cd6805 e8cb64db

+2
+2
drivers/scsi/ufs/ufshcd.c
··· 744 744 if (!ufshcd_is_clkgating_allowed(hba)) 745 745 return; 746 746 device_remove_file(hba->dev, &hba->clk_gating.delay_attr); 747 + cancel_work_sync(&hba->clk_gating.ungate_work); 748 + cancel_delayed_work_sync(&hba->clk_gating.gate_work); 747 749 } 748 750 749 751 /* Must be called with host lock acquired */