mmc: mediatek: fix race condition between msdc_request_timeout and irq
authorChaotian Jing <chaotian.jing@mediatek.com>
Fri, 18 Dec 2020 07:16:11 +0000 (15:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Mar 2021 16:06:23 +0000 (17:06 +0100)
commit35f662ba915e59e096086d74cc4a40f54c746403
treee2d74aaa5e9fd17f3ccec47527dfe036c57695e1
parent7cb2c431583e14604e4af72b72323078dc3e45a8
mmc: mediatek: fix race condition between msdc_request_timeout and irq

[ Upstream commit 0354ca6edd464a2cf332f390581977b8699ed081 ]

when get request SW timeout, if CMD/DAT xfer done irq coming right now,
then there is race between the msdc_request_timeout work and irq handler,
and the host->cmd and host->data may set to NULL in irq handler. also,
current flow ensure that only one path can go to msdc_request_done(), so
no need check the return value of cancel_delayed_work().

Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com>
Link: https://lore.kernel.org/r/20201218071611.12276-1-chaotian.jing@mediatek.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mmc/host/mtk-sd.c