[PATCH RESEND v5 0/3] mtd: spinand: fix continuous reading mode support

Mikhail Kshevetskiy posted 3 patches 2 weeks ago
drivers/mtd/nand/spi/core.c | 74 +++++++++++++++++++++++++++++--------
1 file changed, 59 insertions(+), 15 deletions(-)
[PATCH RESEND v5 0/3] mtd: spinand: fix continuous reading mode support
Posted by Mikhail Kshevetskiy 2 weeks ago
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

Changes v4:
 * the period '.' at the end of the commit title was removed

Changes v5:
 * rename spinand_create_rdesc_helper() to spinand_create_rdesc()
 * get rid of controller_is_buggy boolean

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 | 74 +++++++++++++++++++++++++++++--------
 1 file changed, 59 insertions(+), 15 deletions(-)

-- 
2.51.0
Re: [PATCH RESEND v5 0/3] mtd: spinand: fix continuous reading mode support
Posted by Miquel Raynal 2 days, 17 hours ago
On Thu, 18 Sep 2025 00:53:58 +0300, Mikhail Kshevetskiy wrote:
> 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
> 
> [...]

Applied to nand/next, thanks!

[1/3] mtd: spinand: fix direct mapping creation sizes
      commit: e4a0cf9f1d90e6888e5373da3314f761024f6c97
[2/3] mtd: spinand: try a regular dirmap if creating a dirmap for continuous reading fails
      commit: 004f8ea0d9917398aabff7388b3bf62a84a4088b
[3/3] mtd: spinand: repeat reading in regular mode if continuous reading fails
      commit: 010dc7f2dd6a0078ade3f88f627ed5fbf45ceb94

Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl

Re: [PATCH RESEND v5 0/3] mtd: spinand: fix continuous reading mode support
Posted by Miquel Raynal 2 weeks ago
Hi Mikhail,

> Changes v5:
>  * rename spinand_create_rdesc_helper() to spinand_create_rdesc()
>  * get rid of controller_is_buggy boolean

I received patch 0 and 1 over 3 only. Plus, what is the reason for the
resend? This series was no longer in my watch list which means I was
probably expecting changes on it, which would have lead to a version
increase. Can you please clarify?

Thanks,
Miquèl
Re: [PATCH RESEND v5 0/3] mtd: spinand: fix continuous reading mode support
Posted by Mikhail Kshevetskiy 1 week, 6 days ago
Hello Miquèl,

On 18.09.2025 11:26, Miquel Raynal wrote:
> Hi Mikhail,
>
>> Changes v5:
>>  * rename spinand_create_rdesc_helper() to spinand_create_rdesc()
>>  * get rid of controller_is_buggy boolean
> I received patch 0 and 1 over 3 only.

Quite strange, you was in the "--to" list. Also
https://lkml.org/lkml/2025/9/18/15 see all the series. Could you check
your spam folder and mailer settings?

> Plus, what is the reason for the resend?
No any activities/responds for 2 weeks. This looks like the mails were
lost in the tons of other mails :-(
>  This series was no longer in my watch list which means I was
> probably expecting changes on it, which would have lead to a version
> increase. Can you please clarify?
Hm, I think, I resolve all the issues you mentioned before (in v4 and
v5). Could you look one more time?
>
> Thanks,
> Miquèl


Thanks,
Mikhail Kshevetskiy