[PATCH 0/2] Backport fixes for UBI

Dominique Martinet posted 2 patches 1 month, 1 week ago
drivers/mtd/ubi/attach.c     |  4 +++-
drivers/mtd/ubi/fastmap-wl.c |  8 +-------
drivers/mtd/ubi/io.c         | 10 ++++++++++
drivers/mtd/ubi/ubi.h        | 12 ++++++++++++
4 files changed, 26 insertions(+), 8 deletions(-)
[PATCH 0/2] Backport fixes for UBI
Posted by Dominique Martinet 1 month, 1 week ago
While looking at recent UBI patches I found these two commits that I
believe are worth backporting.

We're not using fastmap so I don't care much about the leak there, but
reducing wear is always good to take

Thanks!

Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
---
Cheng Ming Lin (1):
      mtd: ubi: skip programming unused bits in ubi headers

Liyuan Pang (1):
      ubi: fastmap: fix ubi->fm memory leak

 drivers/mtd/ubi/attach.c     |  4 +++-
 drivers/mtd/ubi/fastmap-wl.c |  8 +-------
 drivers/mtd/ubi/io.c         | 10 ++++++++++
 drivers/mtd/ubi/ubi.h        | 12 ++++++++++++
 4 files changed, 26 insertions(+), 8 deletions(-)
---
base-commit: 98c5a5b9f23ede08be1dcd8be0a13b32fbe2b462
change-id: 20260818-ubi-backports-2f5d76dedbed

Best regards,
--  
Dominique Martinet <dominique.martinet@atmark-techno.com>
Re: [PATCH 0/2] Backport fixes for UBI
Posted by Richard Weinberger 1 month, 1 week ago
----- Ursprüngliche Mail -----
> Von: "Dominique Martinet" <dominique.martinet@atmark-techno.com>
> While looking at recent UBI patches I found these two commits that I
> believe are worth backporting.
> 
> We're not using fastmap so I don't care much about the leak there, but
> reducing wear is always good to take
> 
> Thanks!
> 
> Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
> ---
> Cheng Ming Lin (1):
>      mtd: ubi: skip programming unused bits in ubi headers
> 
> Liyuan Pang (1):
>      ubi: fastmap: fix ubi->fm memory leak

While porting these back is not wrong, I have a hard time to see how the
current stables rules apply here.

"mtd: ubi: skip programming unused bits in ubi headers" does not fix anything.
It's a pure optimization for future flashes, UBI worked since ever without this
change.

"ubi: fastmap: fix ubi->fm memory leak" fixes a memory leak, yes. But only in a failure
path at attach time. Userspace cannot trigger this.

Thanks,
//richard
Re: [PATCH 0/2] Backport fixes for UBI
Posted by Dominique Martinet 1 month, 1 week ago
Richard Weinberger wrote on Wed, Aug 19, 2026 at 12:48:28PM +0200:
> While porting these back is not wrong, I have a hard time to see how the
> current stables rules apply here.

Thank you for looking into this!

I'm honestly fuzzy on stable backport "rules", but in practice I see all
sort of things get in (admitely sometimes new features/refactor just
because it makes an actual fix easier to backport, but also quite a few
leaks on failures like the second patch and other general improvements),
so after noticing someone else submitted 6.12 contiguous read
improvements recently[1] so I assumed such backports would be welcome...
But ultimately I think it's up to you, so happy to see the patches
dropped if you prefer.

[1] https://lore.kernel.org/r/20260811161342.533280-1-frieder@fris.de

> "mtd: ubi: skip programming unused bits in ubi headers" does not fix anything.
> It's a pure optimization for future flashes, UBI worked since ever without this
> change.

I might have misunderstood something about this patch, but while UBI
works fine I believe this would increase the longevity of more than just
"future flashes"

I've burned out 2 times 1MB (4 erase blocks) from the NAND I have on
hand (winbond W25N04LW) using either random data + erase (nandtest) or a
patched version writing zeroes + erase, and writing many zeroes failed
the erase blocks about 40-50% faster (85 thousands cycles vs 132
thousands until the first erase failure, 121/175 until erase stopped
working with many retries)

This obviously is a tiny sample size and not concrete proof, and this
patch won't have such a big impact because the area is small, but I
believe this patch will still improve the endurance a tiny bit for at
least our model, which was the motivation for me to pick this up.

Of course, there's also a chance that something breaks from it so I
can perfectly understand if you prefer not to backport it; you're in a
much better place than me to draw the line.


Thanks,
-- 
Dominique Martinet | Asmadeus
Re: [PATCH 0/2] Backport fixes for UBI
Posted by Sasha Levin 1 month, 1 week ago
On Tue, Aug 18, 2026 at 02:09:33AM +0000, Dominique Martinet wrote:
> While looking at recent UBI patches I found these two commits that I
> believe are worth backporting.

Queued for 6.18 and 6.12, thanks - 6.18 is missing both as well, so it
gets them first.

-- 
Thanks,
Sasha