[PATCH] jffs2: prevent xattr node from overflowing the eraseblock
Ilya Denisyev
dev at elkcl.ru
Mon Apr 15 09:50:23 PDT 2024
On 15.04.2024 17:28, Christian Brauner wrote:
> Can this overflow? I.e. can c->sector_size be smaller than c->cleanmarker_size?
I'm pretty sure that it can't. As far as I know, c->sector_size is at
least the MTD eraseblock size[1] or even bigger in the case of
DataFlash[2]. The cleanmarker is either the size of the smallest JFFS2
node[3] (currently 12 bytes), 0 bytes for certain flash types (like
NAND, where it's stored out of band[4]) or apparently at most the MTD
writesize (which, as far as I understand, is not larger than the
erasesize) for Intel Sibley[5].
Considering that any JFFS2 node must fit inside one block and that the
cleanmarker is the smallest node there is (if it's even a proper node),
it shouldn't overflow, otherwise JFFS2 won't work in the first place.
[1] https://elixir.bootlin.com/linux/v6.9-rc4/source/fs/jffs2/fs.c#L539
[2] https://elixir.bootlin.com/linux/v6.9-rc4/source/fs/jffs2/wbuf.c#L1253
[3] https://elixir.bootlin.com/linux/v6.9-rc4/source/fs/jffs2/fs.c#L557
[4] https://elixir.bootlin.com/linux/v6.9-rc4/source/fs/jffs2/wbuf.c#L1190
[5] https://elixir.bootlin.com/linux/v6.9-rc4/source/fs/jffs2/wbuf.c#L1296
---
Best regards,
Ilya
More information about the linux-mtd
mailing list