mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>, barebox@lists.infradead.org
Subject: Re: [PATCH v3 8/9] fs: Report errors for out-of-bounds protect operations
Date: Wed, 25 Jun 2025 09:11:37 +0200	[thread overview]
Message-ID: <aFuhKVG-nXjH624j@pengutronix.de> (raw)
In-Reply-To: <e2448275-4868-4e13-b4b4-30e182f63d44@pengutronix.de>

On Wed, Jun 25, 2025 at 07:45:39AM +0200, Ahmad Fatoum wrote:
> Hi,
> 
> On 17.06.25 09:56, Sascha Hauer wrote:
> >> -	if (count > f->f_size - offset)
> >> -		count = f->f_size - offset;
> >> +		return errno_set(-ENXIO);
> >> +	if (!count  || count > f->f_size - offset)
> >> +		return errno_set(-EINVAL);
> > 
> > This breaks the saveenv command which does a
> > 
> > 	ret = protect(envfd, ~0, 0, 0);
> > 
> > to unprotect the environment sector. Try on a board with environment in
> > SPI flash.
> 
> Just ran into this as well. It's easy to reproduce with QEMU.

Nah, I shouldn't have applied this series. Oleksij sending two
additional patches somehow trapped me into thinking that with these two
patches that with these everything would be fine.

For now I have dropped this particular patch from -next.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  reply	other threads:[~2025-06-25  7:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-12  6:58 [PATCH v3 0/9] NVMEM: Introduce write protection support Oleksij Rempel
2025-06-12  6:58 ` [PATCH v3 1/9] nvmem: Add 'protect' operation to core framework Oleksij Rempel
2025-06-12  6:58 ` [PATCH v3 2/9] nvmem: rmem: add write and protect support Oleksij Rempel
2025-06-12  6:58 ` [PATCH v3 3/9] commands: nvmem: Add support for creating dynamic rmem devices Oleksij Rempel
2025-06-12  6:58 ` [PATCH v3 4/9] regmap: Add reg_seal operation for hardware protection Oleksij Rempel
2025-06-12  6:58 ` [PATCH v3 5/9] nvmem: regmap: Implement protect operation using regmap_seal Oleksij Rempel
2025-06-12  6:58 ` [PATCH v3 6/9] nvmem: bsec: Implement NVMEM protect via regmap_seal for OTP locking Oleksij Rempel
2025-06-12  6:58 ` [PATCH v3 7/9] nvmem: rmem: ensure unique device name per instance Oleksij Rempel
2025-06-12  6:58 ` [PATCH v3 8/9] fs: Report errors for out-of-bounds protect operations Oleksij Rempel
2025-06-17  7:56   ` Sascha Hauer
2025-06-25  5:45     ` Ahmad Fatoum
2025-06-25  7:11       ` Sascha Hauer [this message]
2025-06-12  6:58 ` [PATCH v3 9/9] test: Add pytest suite for NVMEM framework Oleksij Rempel
2025-06-17  8:03   ` Sascha Hauer
2025-06-17  8:17     ` Oleksij Rempel
2025-06-17  8:04 ` (subset) [PATCH v3 0/9] NVMEM: Introduce write protection support Sascha Hauer
2025-06-23 11:59 ` Sascha Hauer

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=aFuhKVG-nXjH624j@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=o.rempel@pengutronix.de \
    /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