[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZZmh4rdZzj4YgrOG@cae.in-ulm.de>
Date: Sat, 6 Jan 2024 19:54:26 +0100
From: "Christian A. Ehrhardt" <lk@...e.de>
To: Tigran Aivazian <aivazian.tigran@...il.com>
Cc: Xiaochen Zou <xzou017@....edu>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fs/bfs: Null check to prevent null-ptr-deref bug
Hi,
On Sat, Jan 06, 2024 at 08:38:02AM +0000, Tigran Aivazian wrote:
> Hello,
>
> On Fri, 5 Jan 2024 at 19:33, Xiaochen Zou <xzou017@....edu> wrote:
> > Similar to ea2b62f3058 (fs/sysv: Null check to prevent
> > null-ptr-deref bug), bfs is lack of return value check for
> > sb_getblk(). Adding a null check to prevent null-ptr-defer bug
>
> > diff --git a/fs/bfs/file.c b/fs/bfs/file.c
> > index adc2230079c6..35688424bde3 100644
> > --- a/fs/bfs/file.c
> > +++ b/fs/bfs/file.c
> > @@ -39,6 +39,8 @@ static int bfs_move_block(unsigned long from, unsigned long to,
> > if (!bh)
> > return -EIO;
> > new = sb_getblk(sb, to);
> > + if (unlikely(!new))
> > + return -ENOMEM;
>
> Thank you, yes, that makes sense. Please apply the patch.
What's with the bh in this case? Wouldn't we need a brelse or something?
>
> Acknowledged-By; Tigran Aivazian <aivazian.tigran@...il.com>
>
>
regards Christian
Powered by blists - more mailing lists