mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ilya Denisyev <dev@elkcl.ru>
To: Christian Brauner <brauner@kernel.org>
Cc: David Woodhouse <dwmw2@infradead.org>,
	Richard Weinberger <richard@nod.at>,
	Zhihao Cheng <chengzhihao1@huawei.com>,
	Fabian Frederick <fabf@skynet.be>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Wedson Almeida Filho <walmeida@microsoft.com>,
	KaiGai Kohei <kaigai@ak.jp.nec.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org
Subject: Re: [PATCH] jffs2: prevent xattr node from overflowing the eraseblock
Date: Mon, 15 Apr 2024 19:50:23 +0300	[thread overview]
Message-ID: <74f2b16a-dd48-4306-b28b-ad5ba77d8bfe@elkcl.ru> (raw)
In-Reply-To: <20240415-anspielen-gelyncht-d2f0efd6569e@brauner>

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


  reply	other threads:[~2024-04-15 16:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 15:53 Ilya Denisyev
2024-04-15 14:28 ` Christian Brauner
2024-04-15 16:50   ` Ilya Denisyev [this message]
2024-04-17 11:22 ` Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74f2b16a-dd48-4306-b28b-ad5ba77d8bfe@elkcl.ru \
    --to=dev@elkcl.ru \
    --cc=brauner@kernel.org \
    --cc=chengzhihao1@huawei.com \
    --cc=dwmw2@infradead.org \
    --cc=fabf@skynet.be \
    --cc=kaigai@ak.jp.nec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=ndesaulniers@google.com \
    --cc=richard@nod.at \
    --cc=walmeida@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®