mmc: hsq: Fix data stomping during mmc recovery
authorWenchao Chen <wenchao.chen@unisoc.com>
Fri, 16 Sep 2022 09:05:06 +0000 (17:05 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Oct 2022 08:39:38 +0000 (10:39 +0200)
commitfec2db7a434a49d2416a796316aa74f54f1d8ddc
tree6f002082d90250c0326e4a7ac267ecaf103c8afa
parent4fef6e1fe07c86f6abf8b97929aeb12e41122869
mmc: hsq: Fix data stomping during mmc recovery

commit e7afa79a3b35a27a046a2139f8b20bd6b98155c2 upstream.

The block device uses multiple queues to access emmc. There will be up to 3
requests in the hsq of the host. The current code will check whether there
is a request doing recovery before entering the queue, but it will not check
whether there is a request when the lock is issued. The request is in recovery
mode. If there is a request in recovery, then a read and write request is
initiated at this time, and the conflict between the request and the recovery
request will cause the data to be trampled.

Signed-off-by: Wenchao Chen <wenchao.chen@unisoc.com>
Fixes: 511ce378e16f ("mmc: Add MMC host software queue support")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20220916090506.10662-1-wenchao.chen666@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mmc/host/mmc_hsq.c