diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2024-03-07 12:53:15 +0100 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2024-03-15 00:04:51 +0100 |
commit | 4120aa0e3961f68f1f8cfe6b4c3c809ffea31fdc (patch) | |
tree | 2fa58d86bdfd307cdb4abc69cc923a30298710b1 /drivers/mtd | |
parent | 78ffbefba8d7822b232585570b293de5bc397da6 (diff) | |
download | linux-4120aa0e3961f68f1f8cfe6b4c3c809ffea31fdc.tar.gz linux-4120aa0e3961f68f1f8cfe6b4c3c809ffea31fdc.tar.bz2 linux-4120aa0e3961f68f1f8cfe6b4c3c809ffea31fdc.zip |
mtd: rawnand: Ensure continuous reads are well disabled
The cont_read.ongoing flag should only be enabled at the beginning of a
read operation, and also disabled at its end, so we never end up
triggering nasty side effects outside of this scope. The mtd core being
highly serialized, we should not be bothered by parallel accesses
anyway.
In case we reach the end of a read operation and the boolean was not
properly disabled, it's a bug, but it's totally manageable. So warn, and
then fix the boolean state.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20240307115315.1942678-2-miquel.raynal@bootlin.com
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/raw/nand_base.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index 2479fa98f991..d7dbbd469b89 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -3728,6 +3728,9 @@ read_retry: } nand_deselect_target(chip); + if (WARN_ON_ONCE(chip->cont_read.ongoing)) + chip->cont_read.ongoing = false; + ops->retlen = ops->len - (size_t) readlen; if (oob) ops->oobretlen = ops->ooblen - oobreadlen; |