Skip to content

Commit 4120aa0

Browse files
committed
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
1 parent 78ffbef commit 4120aa0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/mtd/nand/raw/nand_base.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3728,6 +3728,9 @@ static int nand_do_read_ops(struct nand_chip *chip, loff_t from,
37283728
}
37293729
nand_deselect_target(chip);
37303730

3731+
if (WARN_ON_ONCE(chip->cont_read.ongoing))
3732+
chip->cont_read.ongoing = false;
3733+
37313734
ops->retlen = ops->len - (size_t) readlen;
37323735
if (oob)
37333736
ops->oobretlen = ops->ooblen - oobreadlen;

0 commit comments

Comments
 (0)