public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Stefan Roese <sr@denx.de>
Cc: "Pali Rohár" <pali@kernel.org>, u-boot@lists.denx.de
Subject: Re: [PATCH] ubifs: Fix lockup/crash when reading files
Date: Mon, 30 May 2022 11:06:55 -0400	[thread overview]
Message-ID: <20220530150655.GQ25375@bill-the-cat> (raw)
In-Reply-To: <6d35daf6-71f7-c0fd-0309-74920566b19b@denx.de>

[-- Attachment #1: Type: text/plain, Size: 1932 bytes --]

On Mon, May 30, 2022 at 08:11:26AM +0200, Stefan Roese wrote:
> Added Tom to Cc...
> 
> On 23.05.22 11:25, Pali Rohár wrote:
> > On Thursday 19 May 2022 10:04:31 Pali Rohár wrote:
> > > On Thursday 19 May 2022 07:01:19 Stefan Roese wrote:
> > > > On 17.05.22 22:45, Pali Rohár wrote:
> > > > > Commit b1a14f8a1c2e ("UBIFS: Change ubifsload to not read beyond the
> > > > > requested size") added optimization to do not read more bytes than it is
> > > > > really needed. But this commit introduced incorrect handling of the hole at
> > > > > the end of file. This logic cause U-Boot to crash or lockup when trying to
> > > > > read from the ubifs filesystem.
> > > > > 
> > > > > When read_block() call returns -ENOENT error (not an error, but the hole)
> > > > > then dn-> structure is not filled and contain garbage. So using of dn->size
> > > > > for memcpy() argument cause that U-Boot tries to copy unspecified amount of
> > > > > bytes from possible unmapped memory. Which randomly cause lockup of P2020
> > > > > CPU.
> > > > > 
> > > > > Fix this issue by copying UBIFS_BLOCK_SIZE bytes from read buffer when
> > > > > dn->size is not available. UBIFS_BLOCK_SIZE is the size of the buffer
> > > > > itself and read_block() fills buffer by zeros when it returns -ENOENT.
> > > > > 
> > > > > This patch fixes ubifsload on P2020.
> > > > > 
> > > > > Fixes: b1a14f8a1c2e ("UBIFS: Change ubifsload to not read beyond the requested size")
> > > > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > > 
> > > > Reviewed-by: Stefan Roese <sr@denx.de>
> > 
> > Anyway, who is maintainer of fs / ubifs code and can take this bugfix patch?
> 
> Tom, could you please pick this patch up? I've seen that you've already
> assigned it to yourself in patchwork:
> 
> http://patchwork.ozlabs.org/project/uboot/patch/20220517204528.7277-1-pali@kernel.org/

I've put it in my queue, thanks.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2022-05-30 15:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17 20:45 [PATCH] ubifs: Fix lockup/crash when reading files Pali Rohár
2022-05-19  5:01 ` Stefan Roese
2022-05-19  8:04   ` Pali Rohár
2022-05-23  9:25     ` Pali Rohár
2022-05-30  6:11       ` Stefan Roese
2022-05-30 15:06         ` Tom Rini [this message]
2022-06-03 19:48 ` Tom Rini

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=20220530150655.GQ25375@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=pali@kernel.org \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.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