All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Christian Loehle <cloehle@hyperstone.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>
Subject: [PATCH 5.10 015/121] mmc: block: fix read single on recovery logic
Date: Mon, 21 Feb 2022 09:48:27 +0100	[thread overview]
Message-ID: <20220221084921.667232415@linuxfoundation.org> (raw)
In-Reply-To: <20220221084921.147454846@linuxfoundation.org>

From: Christian Löhle <CLoehle@hyperstone.com>

commit 54309fde1a352ad2674ebba004a79f7d20b9f037 upstream.

On reads with MMC_READ_MULTIPLE_BLOCK that fail,
the recovery handler will use MMC_READ_SINGLE_BLOCK for
each of the blocks, up to MMC_READ_SINGLE_RETRIES times each.
The logic for this is fixed to never report unsuccessful reads
as success to the block layer.

On command error with retries remaining, blk_update_request was
called with whatever value error was set last to.
In case it was last set to BLK_STS_OK (default), the read will be
reported as success, even though there was no data read from the device.
This could happen on a CRC mismatch for the response,
a card rejecting the command (e.g. again due to a CRC mismatch).
In case it was last set to BLK_STS_IOERR, the error is reported correctly,
but no retries will be attempted.

Fixes: 81196976ed946c ("mmc: block: Add blk-mq support")
Cc: stable@vger.kernel.org
Signed-off-by: Christian Loehle <cloehle@hyperstone.com>
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/bc706a6ab08c4fe2834ba0c05a804672@hyperstone.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/mmc/core/block.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -1642,31 +1642,31 @@ static void mmc_blk_read_single(struct m
 	struct mmc_card *card = mq->card;
 	struct mmc_host *host = card->host;
 	blk_status_t error = BLK_STS_OK;
-	int retries = 0;
 
 	do {
 		u32 status;
 		int err;
+		int retries = 0;
 
-		mmc_blk_rw_rq_prep(mqrq, card, 1, mq);
+		while (retries++ <= MMC_READ_SINGLE_RETRIES) {
+			mmc_blk_rw_rq_prep(mqrq, card, 1, mq);
 
-		mmc_wait_for_req(host, mrq);
+			mmc_wait_for_req(host, mrq);
 
-		err = mmc_send_status(card, &status);
-		if (err)
-			goto error_exit;
-
-		if (!mmc_host_is_spi(host) &&
-		    !mmc_ready_for_data(status)) {
-			err = mmc_blk_fix_state(card, req);
+			err = mmc_send_status(card, &status);
 			if (err)
 				goto error_exit;
-		}
 
-		if (mrq->cmd->error && retries++ < MMC_READ_SINGLE_RETRIES)
-			continue;
+			if (!mmc_host_is_spi(host) &&
+			    !mmc_ready_for_data(status)) {
+				err = mmc_blk_fix_state(card, req);
+				if (err)
+					goto error_exit;
+			}
 
-		retries = 0;
+			if (!mrq->cmd->error)
+				break;
+		}
 
 		if (mrq->cmd->error ||
 		    mrq->data->error ||



  parent reply	other threads:[~2022-02-21  9:15 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21  8:48 [PATCH 5.10 000/121] 5.10.102-rc1 review Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 001/121] drm/nouveau/pmu/gm200-: use alternate falcon reset sequence Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 002/121] mm: memcg: synchronize objcg lists with a dedicated spinlock Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 003/121] rcu: Do not report strict GPs for outgoing CPUs Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 004/121] fget: clarify and improve __fget_files() implementation Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 005/121] fs/proc: task_mmu.c: dont read mapcount for migration entry Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 006/121] can: isotp: prevent race between isotp_bind() and isotp_setsockopt() Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 007/121] can: isotp: add SF_BROADCAST support for functional addressing Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 008/121] scsi: lpfc: Fix mailbox command failure during driver initialization Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 009/121] HID:Add support for UGTABLET WP5540 Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 010/121] Revert "svm: Add warning message for AVIC IPI invalid target" Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 011/121] serial: parisc: GSC: fix build when IOSAPIC is not set Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 012/121] parisc: Drop __init from map_pages declaration Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 013/121] parisc: Fix data TLB miss in sba_unmap_sg Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 014/121] parisc: Fix sglist access in ccio-dma.c Greg Kroah-Hartman
2022-02-21  8:48 ` Greg Kroah-Hartman [this message]
2022-02-21  8:48 ` [PATCH 5.10 016/121] mm: dont try to NUMA-migrate COW pages that have other uses Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 017/121] PCI: hv: Fix NUMA node assignment when kernel boots with custom NUMA topology Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 018/121] parisc: Add ioread64_lo_hi() and iowrite64_lo_hi() Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 019/121] btrfs: send: in case of IO error log it Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 020/121] platform/x86: touchscreen_dmi: Add info for the RWC NANOTE P8 AY07J 2-in-1 Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 021/121] platform/x86: ISST: Fix possible circular locking dependency detected Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 022/121] selftests: rtc: Increase test timeout so that all tests run Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 023/121] kselftest: signal all child processes Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 024/121] net: ieee802154: at86rf230: Stop leaking skbs Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 025/121] selftests/zram: Skip max_comp_streams interface on newer kernel Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 026/121] selftests/zram01.sh: Fix compression ratio calculation Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 027/121] selftests/zram: Adapt the situation that /dev/zram0 is being used Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 028/121] selftests: openat2: Print also errno in failure messages Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 029/121] selftests: openat2: Add missing dependency in Makefile Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 030/121] selftests: openat2: Skip testcases that fail with EOPNOTSUPP Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 031/121] selftests: skip mincore.check_file_mmap when fs lacks needed support Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 032/121] ax25: improve the incomplete fix to avoid UAF and NPD bugs Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 033/121] vfs: make freeze_super abort when sync_filesystem returns error Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 034/121] quota: make dquot_quota_sync return errors from ->sync_fs Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 035/121] scsi: pm8001: Fix use-after-free for aborted TMF sas_task Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 036/121] scsi: pm8001: Fix use-after-free for aborted SSP/STP sas_task Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 037/121] nvme: fix a possible use-after-free in controller reset during load Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 038/121] nvme-tcp: fix possible use-after-free in transport error_recovery work Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 039/121] nvme-rdma: " Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 040/121] drm/amdgpu: fix logic inversion in check Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 041/121] x86/Xen: streamline (and fix) PV CPU enumeration Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 042/121] Revert "module, async: async_synchronize_full() on module init iff async is used" Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 043/121] gcc-plugins/stackleak: Use noinstr in favor of notrace Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 044/121] random: wake up /dev/random writers after zap Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 045/121] kbuild: lto: merge module sections Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 046/121] kbuild: lto: Merge module sections if and only if CONFIG_LTO_CLANG is enabled Greg Kroah-Hartman
2022-02-21  8:48 ` [PATCH 5.10 047/121] iwlwifi: fix use-after-free Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 048/121] drm/radeon: Fix backlight control on iMac 12,1 Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 049/121] drm/i915/opregion: check port number bounds for SWSCI display power state Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 050/121] vsock: remove vsock from connected table when connect is interrupted by a signal Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 051/121] drm/i915/gvt: Make DRM_I915_GVT depend on X86 Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 052/121] iwlwifi: pcie: fix locking when "HW not ready" Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 053/121] iwlwifi: pcie: gen2: " Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 054/121] selftests: netfilter: fix exit value for nft_concat_range Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 055/121] netfilter: nft_synproxy: unregister hooks on init error path Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 056/121] ipv6: per-netns exclusive flowlabel checks Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 057/121] net: dsa: lan9303: fix reset on probe Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 058/121] net: dsa: lantiq_gswip: fix use after free in gswip_remove() Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 059/121] net: ieee802154: ca8210: Fix lifs/sifs periods Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 060/121] ping: fix the dif and sdif check in ping_lookup Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 061/121] bonding: force carrier update when releasing slave Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 062/121] drop_monitor: fix data-race in dropmon_net_event / trace_napi_poll_hit Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 063/121] net_sched: add __rcu annotation to netdev->qdisc Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 064/121] bonding: fix data-races around agg_select_timer Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 065/121] libsubcmd: Fix use-after-free for realloc(..., 0) Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 066/121] dpaa2-eth: Initialize mutex used in one step timestamping path Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 067/121] perf bpf: Defer freeing string after possible strlen() on it Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 068/121] selftests/exec: Add non-regular to TEST_GEN_PROGS Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 069/121] ALSA: hda/realtek: Add quirk for Legion Y9000X 2019 Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 070/121] ALSA: hda/realtek: Fix deadlock by COEF mutex Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 071/121] ALSA: hda: Fix regression on forced probe mask option Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 072/121] ALSA: hda: Fix missing codec probe on Shenker Dock 15 Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 073/121] ASoC: ops: Fix stereo change notifications in snd_soc_put_volsw() Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 074/121] ASoC: ops: Fix stereo change notifications in snd_soc_put_volsw_range() Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 075/121] powerpc/lib/sstep: fix ptesync build error Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 076/121] mtd: rawnand: gpmi: dont leak PM reference in error path Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 077/121] KVM: SVM: Never reject emulation due to SMAP errata for !SEV guests Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 078/121] tee: export teedev_open() and teedev_close_context() Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 079/121] optee: use driver internal tee_context for some rpc Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 080/121] ASoC: tas2770: Insert post reset delay Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 081/121] block/wbt: fix negative inflight counter when remove scsi device Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 082/121] NFS: LOOKUP_DIRECTORY is also ok with symlinks Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 083/121] NFS: Do not report writeback errors in nfs_getattr() Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 084/121] tty: n_tty: do not look ahead for EOL character past the end of the buffer Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 085/121] mtd: rawnand: qcom: Fix clock sequencing in qcom_nandc_probe() Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 086/121] mtd: rawnand: brcmnand: Fixed incorrect sub-page ECC status Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 087/121] Drivers: hv: vmbus: Fix memory leak in vmbus_add_channel_kobj Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 088/121] KVM: x86/pmu: Refactoring find_arch_event() to pmc_perf_hw_id() Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 089/121] KVM: x86/pmu: Dont truncate the PerfEvtSeln MSR when creating a perf event Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 090/121] KVM: x86/pmu: Use AMD64_RAW_EVENT_MASK for PERF_TYPE_RAW Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 091/121] NFS: Dont set NFS_INO_INVALID_XATTR if there is no xattr cache Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 092/121] ARM: OMAP2+: hwmod: Add of_node_put() before break Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 093/121] ARM: OMAP2+: adjust the location of put_device() call in omapdss_init_of Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 094/121] phy: usb: Leave some clocks running during suspend Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 095/121] irqchip/sifive-plic: Add missing thead,c900-plic match string Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 096/121] netfilter: conntrack: dont refresh sctp entries in closed state Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 097/121] arm64: dts: meson-gx: add ATF BL32 reserved-memory region Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 098/121] arm64: dts: meson-g12: " Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 099/121] arm64: dts: meson-g12: drop BL32 region from SEI510/SEI610 Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 100/121] pidfd: fix test failure due to stack overflow on some arches Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 101/121] selftests: fixup build warnings in pidfd / clone3 tests Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 102/121] kconfig: let shell return enough output for deep path names Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 103/121] ata: libata-core: Disable TRIM on M88V29 Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 104/121] soc: aspeed: lpc-ctrl: Block error printing on probe defer cases Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 105/121] xprtrdma: fix pointer derefs in error cases of rpcrdma_ep_create Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 106/121] drm/rockchip: dw_hdmi: Do not leave clock enabled in error case Greg Kroah-Hartman
2022-02-21  8:49 ` [PATCH 5.10 107/121] tracing: Fix tp_printk option related with tp_printk_stop_on_boot Greg Kroah-Hartman
2022-02-21  8:50 ` [PATCH 5.10 108/121] net: usb: qmi_wwan: Add support for Dell DW5829e Greg Kroah-Hartman
2022-02-21  8:50 ` [PATCH 5.10 109/121] net: macb: Align the dma and coherent dma masks Greg Kroah-Hartman
2022-02-21  8:50 ` [PATCH 5.10 110/121] kconfig: fix failing to generate auto.conf Greg Kroah-Hartman
2022-02-21  8:50 ` [PATCH 5.10 111/121] scsi: lpfc: Fix pt2pt NVMe PRLI reject LOGO loop Greg Kroah-Hartman
2022-02-21  8:50 ` [PATCH 5.10 112/121] EDAC: Fix calculation of returned address and next offset in edac_align_ptr() Greg Kroah-Hartman
2022-02-21  8:50 ` [PATCH 5.10 113/121] net: sched: limit TC_ACT_REPEAT loops Greg Kroah-Hartman
2022-02-21  8:50 ` [PATCH 5.10 114/121] dmaengine: sh: rcar-dmac: Check for error num after setting mask Greg Kroah-Hartman
2022-02-21  8:50 ` [PATCH 5.10 115/121] dmaengine: stm32-dmamux: Fix PM disable depth imbalance in stm32_dmamux_probe Greg Kroah-Hartman
2022-02-21  8:50 ` [PATCH 5.10 116/121] dmaengine: sh: rcar-dmac: Check for error num after dma_set_max_seg_size Greg Kroah-Hartman
2022-02-21  8:50 ` [PATCH 5.10 117/121] i2c: qcom-cci: dont delete an unregistered adapter Greg Kroah-Hartman
2022-02-21  8:50 ` [PATCH 5.10 118/121] i2c: qcom-cci: dont put a device tree node before i2c_add_adapter() Greg Kroah-Hartman
2022-02-21  8:50 ` [PATCH 5.10 119/121] copy_process(): Move fd_install() out of sighand->siglock critical section Greg Kroah-Hartman
2022-02-21  8:50 ` [PATCH 5.10 120/121] i2c: brcmstb: fix support for DSL and CM variants Greg Kroah-Hartman
2022-02-21  8:50 ` [PATCH 5.10 121/121] lockdep: Correct lock_classes index mapping Greg Kroah-Hartman
2022-02-21 12:24 ` [PATCH 5.10 000/121] 5.10.102-rc1 review Pavel Machek
2022-02-21 21:18 ` Guenter Roeck
2022-02-21 21:39 ` Shuah Khan
2022-02-22  0:45 ` Samuel Zou
2022-02-22  3:19 ` Slade Watkins
2022-02-22  3:41 ` Florian Fainelli
2022-02-22  3:42 ` Bagas Sanjaya
2022-02-22  6:38 ` Naresh Kamboju
2022-02-22 12:06 ` Sudip Mukherjee
2022-02-22 12:09 ` Jon Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220221084921.667232415@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=adrian.hunter@intel.com \
    --cc=cloehle@hyperstone.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.