The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Alan Huang <mmpgouride@gmail.com>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Jeongjun Park <aha310510@gmail.com>,
	linux-bcachefs@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	syzbot+b468b9fef56949c3b528@syzkaller.appspotmail.com
Subject: Re: [PATCH v2] bcachefs: fix null-ptr-deref in have_stripes()
Date: Sat, 26 Oct 2024 01:05:50 +0800	[thread overview]
Message-ID: <C6638CB8-4DAF-466F-B1F1-34883C693C2E@gmail.com> (raw)
In-Reply-To: <n6nisrv3mklka3whfosvhrcevivri76clgijy3ijdxfbzjkuc3@wuogkgi5kf4s>

On Oct 26, 2024, at 00:54, Kent Overstreet <kent.overstreet@linux.dev> wrote:
> 
> On Fri, Oct 25, 2024 at 08:56:18PM +0900, Jeongjun Park wrote:
>> c->btree_roots_known[i].b can be NULL. In this case, a NULL pointer dereference
>> occurs, so you need to add code to check the variable.
>> 
>> Reported-by: syzbot+b468b9fef56949c3b528@syzkaller.appspotmail.com
>> Fixes: 7773df19c35f ("bcachefs: metadata version bucket_stripe_sectors")
>> Signed-off-by: Jeongjun Park <aha310510@gmail.com>
> 
> This looks identical to the v1? It's already in my testing branch

This version fix the “Fixes" tag, the original one is:

"Fixes: ("bcachefs: metadata version bucket_stripe_sectors”)"

> 
> (But it should be in my hotfix branch, doing that now)
> 
>> ---
>> fs/bcachefs/sb-downgrade.c | 3 +++
>> 1 file changed, 3 insertions(+)
>> 
>> diff --git a/fs/bcachefs/sb-downgrade.c b/fs/bcachefs/sb-downgrade.c
>> index ae715ff658e8..8767c33c2b51 100644
>> --- a/fs/bcachefs/sb-downgrade.c
>> +++ b/fs/bcachefs/sb-downgrade.c
>> @@ -143,6 +143,9 @@ UPGRADE_TABLE()
>> 
>> static int have_stripes(struct bch_fs *c)
>> {
>> + if (IS_ERR_OR_NULL(c->btree_roots_known[BTREE_ID_stripes].b))
>> + return 0;
>> +
>> return !btree_node_fake(c->btree_roots_known[BTREE_ID_stripes].b);
>> }
>> 
>> --
> 


  reply	other threads:[~2024-10-25 17:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-25 11:56 [PATCH v2] bcachefs: fix null-ptr-deref in have_stripes() Jeongjun Park
2024-10-25 16:54 ` Kent Overstreet
2024-10-25 17:05   ` Alan Huang [this message]
2024-10-25 17:17     ` Kent Overstreet

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=C6638CB8-4DAF-466F-B1F1-34883C693C2E@gmail.com \
    --to=mmpgouride@gmail.com \
    --cc=aha310510@gmail.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcachefs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+b468b9fef56949c3b528@syzkaller.appspotmail.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