[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <n6nisrv3mklka3whfosvhrcevivri76clgijy3ijdxfbzjkuc3@wuogkgi5kf4s>
Date: Fri, 25 Oct 2024 12:54:53 -0400
From: Kent Overstreet <kent.overstreet@...ux.dev>
To: Jeongjun Park <aha310510@...il.com>
Cc: linux-bcachefs@...r.kernel.org, linux-kernel@...r.kernel.org,
syzbot+b468b9fef56949c3b528@...kaller.appspotmail.com
Subject: Re: [PATCH v2] bcachefs: fix null-ptr-deref in have_stripes()
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@...kaller.appspotmail.com
> Fixes: 7773df19c35f ("bcachefs: metadata version bucket_stripe_sectors")
> Signed-off-by: Jeongjun Park <aha310510@...il.com>
This looks identical to the v1? It's already in my testing branch
(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);
> }
>
> --
Powered by blists - more mailing lists