mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: David Lee <david.lee@trailofbits.com>, Chris Mason <clm@fb.com>
Cc: David Sterba <dsterba@suse.com>,
	Dominik 'Disconnect3d' Czarnota
	<dominik.czarnota@trailofbits.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: lzo: reject inline extents without both headers
Date: Tue, 14 Jul 2026 18:27:30 +0930	[thread overview]
Message-ID: <bbd8db69-6541-4790-890f-fdbda17e1cde@gmx.com> (raw)
In-Reply-To: <31f257bd-bcdf-454f-8561-a03ce42380c2@gmx.com>



在 2026/7/14 18:08, Qu Wenruo 写道:
> 
> 
> 在 2026/7/14 16:40, David Lee 写道:
>> inline Btrfs LZO payload shorter than two LZO headers.
>>
>> Fix the validation or lifetime rule at the vulnerable boundary so 
>> malformed
>> or racing input cannot reach the faulting path.
>>
>> Signed-off-by: David Lee <david.lee@trailofbits.com>
>> Assisted-by: Codex:gpt-5.5
>> ---
>> Trail of Bits has a reproducer for this bug demonstrating Kernel Panic 
>> which can be shared further if needed.

Also forgot to mention, it's always better to provide the full calltrace.

It will benefit people who hit a similar crash to determine if it's 
already fixed.
>>
>> fs/btrfs/lzo.c |    3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c
>> --- a/fs/btrfs/lzo.c
>> +++ b/fs/btrfs/lzo.c
>> @@ -552,7 +552,8 @@ int lzo_decompress(struct list_head *ws, const u8 
>> *data_in,
>>       size_t max_segment_len = workspace_buf_length(fs_info);
>>       int ret;
>> -    if (unlikely(srclen < LZO_LEN || srclen > max_segment_len + 
>> LZO_LEN * 2))
>> +    if (unlikely(srclen < LZO_LEN * 2 ||
> 
> srclen == LZO_LEN * 2 is also invalid, as that means the lzo payload is 
> empty.
> 
> 
> Also your base is a little too old.
> 
> The latest for-next branch has extra error messages, thus your patch 
> doesn't apply cleanly.
> 
> Please rebase to the latest for-next branch:
> 
>   https://github.com/btrfs/linux.git for-next
> 
> Otherwise the fix looks good to me.
> 
> Thanks,
> Qu
> 
>> +             srclen > max_segment_len + LZO_LEN * 2))
>>           return -EUCLEAN;
>>       in_len = get_unaligned_le32(data_in);
>>
>>
> 
> 


      reply	other threads:[~2026-07-14  8:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14  7:10 David Lee
2026-07-14  8:38 ` Qu Wenruo
2026-07-14  8:57   ` Qu Wenruo [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=bbd8db69-6541-4790-890f-fdbda17e1cde@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=clm@fb.com \
    --cc=david.lee@trailofbits.com \
    --cc=dominik.czarnota@trailofbits.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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®