Re: [PATCH] fs/bfs: Null check to prevent null-ptr-deref bug

From: Tigran Aivazian
Date: Sun Jan 07 2024 - 10:23:52 EST


Hi,

On Sat, 6 Jan 2024 at 18:54, Christian A. Ehrhardt <lk@xxxxxxx> wrote:
> > > if (!bh)
> > > return -EIO;
> > > new = sb_getblk(sb, to);
> > > + if (unlikely(!new))
> > > + return -ENOMEM;
>
> What's with the bh in this case? Wouldn't we need a brelse or something?

Oh sorry, mea culpa et senecta :) Since the data has been read into bh
then I suppose we need bforget(bh) rather than brelse(bh) before
returning -ENOMEM above.

Kind regards,
Tigran