OSDN Git Service

ufs: ensure clk gating work is finished before module unloading
authorAkinobu Mita <akinobu.mita@gmail.com>
Mon, 24 Nov 2014 05:24:18 +0000 (14:24 +0900)
committerChristoph Hellwig <hch@lst.de>
Wed, 26 Nov 2014 10:32:32 +0000 (11:32 +0100)
commit97cd6805acf0d6b1b06b439cbc8c25586d73dcfc
treeeb9984611dcdf7f751c24479d8f88d740de4ba45
parente8cb64db81e8c88c5c824ca74c2e57b4c6919ca6
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>
drivers/scsi/ufs/ufshcd.c