From: Tom Rini <trini@konsulko.com>
To: Sam Edwards <cfsworks@gmail.com>
Cc: u-boot@lists.denx.de, "Marek Behún" <kabel@kernel.org>,
"Qu Wenruo" <wqu@suse.com>
Subject: Re: [PATCH] fs: btrfs: fix reading when length specified
Date: Fri, 17 Nov 2023 08:41:46 -0500 [thread overview]
Message-ID: <20231117134146.GR170968@bill-the-cat> (raw)
In-Reply-To: <20231111151904.149009-1-CFSworks@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]
On Sat, Nov 11, 2023 at 08:19:04AM -0700, Sam Edwards wrote:
> The btrfs read function limits the read length to ensure that it
> and the read offset do not together exceed the size of the file.
> However, this size was only being queried if the read length was
> passed a value of zero (meaning "whole file"), and the size is
> defaulted to 0 otherwise. This means the clamp will just zero out
> the length if one is specified, preventing reading of the file.
>
> Fix this by checking the file size unconditionally, and unifying
> the default length and clamping logic as a single range check instead.
>
> This bug was discovered when trying to boot Linux with initrd= via
> 'bootefi' from a btrfs partition. The EFI stub entered an infinite
> loop of zero-length reads while trying to read the initrd, and the
> boot process stalled indefinitely.
>
> Signed-off-by: Sam Edwards <CFSworks@gmail.com>
> Reviewed-by: Qu Wenruo <wqu@suse.com>
Applied to u-boot/next, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
prev parent reply other threads:[~2023-11-17 13:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-11 15:19 [PATCH] fs: btrfs: fix reading when length specified Sam Edwards
2023-11-16 4:43 ` Qu Wenruo
2023-11-17 0:02 ` Sam Edwards
2023-11-17 13:41 ` Tom Rini [this message]
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=20231117134146.GR170968@bill-the-cat \
--to=trini@konsulko.com \
--cc=cfsworks@gmail.com \
--cc=kabel@kernel.org \
--cc=u-boot@lists.denx.de \
--cc=wqu@suse.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