linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] mtd: spinand: fix continuous reading mode support
@ 2025-08-20 12:20 Mikhail Kshevetskiy
  2025-08-20 12:20 ` [PATCH v3 1/3] mtd: spinand: fix direct mapping creation sizes Mikhail Kshevetskiy
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Mikhail Kshevetskiy @ 2025-08-20 12:20 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Tudor Ambarus, Takahiro Kuwano, Martin Kurbanov, Cheng Ming Lin,
	linux-mtd, linux-kernel, Frieder Schrempf, Mark Brown
  Cc: Mikhail Kshevetskiy

Continuous reading mode is broken for some spi controllers. There are two
possible bug scenarios:

1) "continuous mode" flash and spi controller without dirmap support,
   but with restriction on transfer length in adjust_op_size()

2) "continuous mode" flash and spi controller with dirmap support for a
   single flash page

In the first case, any read that exceeds the limit specified in adjust_op_size()
will result in an EIO error. The limit may even be less than a size of a single
flash page. In this case, any read will result in an error.

In the second case, any read larger than flash page size will result in an EIO
error or spinand driver spoofing (because the spi controller driver returns
more bytes than were actually read).

This patch series tries to fix continuous reading (spinand driver side).
Unfortunately these fixes can't resolve "spinand driver spoofing" case.
Spi controller drivers might need fixes as well.

Changes v2:
 * added helper to create reading dirmap descriptor
 * fix spelling
 * error code is not used for regular reading fallback anymore
 * it's possible (but very unlucky) that someone will do raw reading
   of the flash in continuous mode (i.e. without OOB), so fix dirmap
   creation for that case as well.

Changes v3:
 * improve description
 * move airoha spi controller driver fix to a separate airoha spi fix series

Mikhail Kshevetskiy (3):
  mtd: spinand: fix direct mapping creation sizes.
  mtd: spinand: try a regular dirmap if creating a dirmap for continuous
    reading fails
  mtd: spinand: repeat reading in regular mode if continuous reading
    fails

 drivers/mtd/nand/spi/core.c | 88 ++++++++++++++++++++++++++++---------
 1 file changed, 68 insertions(+), 20 deletions(-)

-- 
2.50.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-08-29  7:15 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-20 12:20 [PATCH v3 0/3] mtd: spinand: fix continuous reading mode support Mikhail Kshevetskiy
2025-08-20 12:20 ` [PATCH v3 1/3] mtd: spinand: fix direct mapping creation sizes Mikhail Kshevetskiy
2025-08-24 16:27   ` Miquel Raynal
2025-08-24 17:13     ` [PATCH v4 0/3] mtd: spinand: fix continuous reading mode support Mikhail Kshevetskiy
2025-08-24 17:13       ` [PATCH v4 1/3] mtd: spinand: fix direct mapping creation sizes Mikhail Kshevetskiy
2025-08-24 17:13       ` [PATCH v4 2/3] mtd: spinand: try a regular dirmap if creating a dirmap for continuous reading fails Mikhail Kshevetskiy
2025-08-24 17:13       ` [PATCH v4 3/3] mtd: spinand: repeat reading in regular mode if " Mikhail Kshevetskiy
2025-08-24 18:18       ` [PATCH v5 0/3] mtd: spinand: fix continuous reading mode support Mikhail Kshevetskiy
2025-08-24 18:18         ` [PATCH v5 1/3] mtd: spinand: fix direct mapping creation sizes Mikhail Kshevetskiy
2025-08-24 18:18         ` [PATCH v5 2/3] mtd: spinand: try a regular dirmap if creating a dirmap for continuous reading fails Mikhail Kshevetskiy
2025-08-24 18:18         ` [PATCH v5 3/3] mtd: spinand: repeat reading in regular mode if " Mikhail Kshevetskiy
2025-08-29  7:15         ` [PATCH v5 0/3] mtd: spinand: fix continuous reading mode support Mikhail Kshevetskiy
2025-08-20 12:20 ` [PATCH v3 2/3] mtd: spinand: try a regular dirmap if creating a dirmap for continuous reading fails Mikhail Kshevetskiy
2025-08-20 12:21 ` [PATCH v3 3/3] mtd: spinand: repeat reading in regular mode if " Mikhail Kshevetskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).