linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] reiserfs: Check the return value from __getblk()
       [not found] <20230605142335.2883264-1-willy@infradead.org>
@ 2023-06-29 21:26 ` Matthew Wilcox
  2023-06-30  9:03   ` Christian Brauner
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2023-06-29 21:26 UTC (permalink / raw)
  To: reiserfs-devel, Jan Kara, Andrew Morton, Christian Brauner,
	linux-fsdevel
  Cc: butt3rflyh4ck


I was expecting Jan to pick this one up, but it's not in his pull
request that just got merged.  Looking at patches to reiserfs over the
last few cycles, patches go in a few different ways; there doesn't seem
to be a defined path.  Anyone want to take this one?

On Mon, Jun 05, 2023 at 03:23:34PM +0100, Matthew Wilcox (Oracle) wrote:
> __getblk() can return a NULL pointer if we run out of memory or if
> we try to access beyond the end of the device; check it and handle it
> appropriately.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Link: https://lore.kernel.org/lkml/CAFcO6XOacq3hscbXevPQP7sXRoYFz34ZdKPYjmd6k5sZuhGFDw@mail.gmail.com/
> Tested-by: butt3rflyh4ck <butterflyhuangxx@gmail.com>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") # probably introduced in 2002
> ---
>  fs/reiserfs/journal.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
> index 4d11d60f493c..dd58e0dca5e5 100644
> --- a/fs/reiserfs/journal.c
> +++ b/fs/reiserfs/journal.c
> @@ -2326,7 +2326,7 @@ static struct buffer_head *reiserfs_breada(struct block_device *dev,
>  	int i, j;
>  
>  	bh = __getblk(dev, block, bufsize);
> -	if (buffer_uptodate(bh))
> +	if (!bh || buffer_uptodate(bh))
>  		return (bh);
>  
>  	if (block + BUFNR > max_block) {
> @@ -2336,6 +2336,8 @@ static struct buffer_head *reiserfs_breada(struct block_device *dev,
>  	j = 1;
>  	for (i = 1; i < blocks; i++) {
>  		bh = __getblk(dev, block + i, bufsize);
> +		if (!bh)
> +			break;
>  		if (buffer_uptodate(bh)) {
>  			brelse(bh);
>  			break;
> -- 
> 2.39.2
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] reiserfs: Check the return value from __getblk()
  2023-06-29 21:26 ` [PATCH] reiserfs: Check the return value from __getblk() Matthew Wilcox
@ 2023-06-30  9:03   ` Christian Brauner
  2023-07-04 18:49     ` Matthew Wilcox
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Brauner @ 2023-06-30  9:03 UTC (permalink / raw)
  To: reiserfs-devel, Jan Kara, Andrew Morton, Christian Brauner,
	linux-fsdevel
  Cc: Matthew Wilcox, butt3rflyh4ck

From: Matthew Wilcox <willy@infradead.org>

On Thu, 29 Jun 2023 23:26:17 +0200, Matthew Wilcox wrote:
> __getblk() can return a NULL pointer if we run out of memory or if
> we try to access beyond the end of the device; check it and handle it
> appropriately.
> 
> [...]

Willy's original commit with message id
<20230605142335.2883264-1-willy@infradead.org> didn't show up on lore.
Might be because reiserfs-devel isn't a list tracked by lore; not sure.
So I grabbed this from somewhere else.

In any case, I picked this up now.

---

Applied to the vfs.misc branch of the vfs/vfs.git tree.
Patches in the vfs.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc

[1/1] reiserfs: Check the return value from __getblk()
      commit: https://git.kernel.org/vfs/vfs/c/958c5fee0047

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] reiserfs: Check the return value from __getblk()
  2023-06-30  9:03   ` Christian Brauner
@ 2023-07-04 18:49     ` Matthew Wilcox
  2023-07-05  7:08       ` Christian Brauner
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2023-07-04 18:49 UTC (permalink / raw)
  To: Christian Brauner
  Cc: reiserfs-devel, Jan Kara, Andrew Morton, linux-fsdevel,
	butt3rflyh4ck

On Fri, Jun 30, 2023 at 11:03:05AM +0200, Christian Brauner wrote:
> From: Matthew Wilcox <willy@infradead.org>
> 
> On Thu, 29 Jun 2023 23:26:17 +0200, Matthew Wilcox wrote:
> > __getblk() can return a NULL pointer if we run out of memory or if
> > we try to access beyond the end of the device; check it and handle it
> > appropriately.
> > 
> > [...]
> 
> Willy's original commit with message id
> <20230605142335.2883264-1-willy@infradead.org> didn't show up on lore.
> Might be because reiserfs-devel isn't a list tracked by lore; not sure.
> So I grabbed this from somewhere else.
> 
> In any case, I picked this up now.
> 
> ---
> 
> Applied to the vfs.misc branch of the vfs/vfs.git tree.
> Patches in the vfs.misc branch should appear in linux-next soon.
> 
> Please report any outstanding bugs that were missed during review in a
> new review to the original patch series allowing us to drop it.
> 
> It's encouraged to provide Acked-bys and Reviewed-bys even though the
> patch has now been applied. If possible patch trailers will be updated.

Acked-by: Edward Shishkin <edward.shishkin@gmail.com>

was added in a response to the original, FYI

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] reiserfs: Check the return value from __getblk()
  2023-07-04 18:49     ` Matthew Wilcox
@ 2023-07-05  7:08       ` Christian Brauner
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Brauner @ 2023-07-05  7:08 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: reiserfs-devel, Jan Kara, Andrew Morton, linux-fsdevel,
	butt3rflyh4ck

On Tue, Jul 04, 2023 at 07:49:24PM +0100, Matthew Wilcox wrote:
> On Fri, Jun 30, 2023 at 11:03:05AM +0200, Christian Brauner wrote:
> > From: Matthew Wilcox <willy@infradead.org>
> > 
> > On Thu, 29 Jun 2023 23:26:17 +0200, Matthew Wilcox wrote:
> > > __getblk() can return a NULL pointer if we run out of memory or if
> > > we try to access beyond the end of the device; check it and handle it
> > > appropriately.
> > > 
> > > [...]
> > 
> > Willy's original commit with message id
> > <20230605142335.2883264-1-willy@infradead.org> didn't show up on lore.
> > Might be because reiserfs-devel isn't a list tracked by lore; not sure.
> > So I grabbed this from somewhere else.
> > 
> > In any case, I picked this up now.
> > 
> > ---
> > 
> > Applied to the vfs.misc branch of the vfs/vfs.git tree.
> > Patches in the vfs.misc branch should appear in linux-next soon.
> > 
> > Please report any outstanding bugs that were missed during review in a
> > new review to the original patch series allowing us to drop it.
> > 
> > It's encouraged to provide Acked-bys and Reviewed-bys even though the
> > patch has now been applied. If possible patch trailers will be updated.
> 
> Acked-by: Edward Shishkin <edward.shishkin@gmail.com>
> 
> was added in a response to the original, FYI

Thank you! I've updated the patch trailer accordingly.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-05  7:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230605142335.2883264-1-willy@infradead.org>
2023-06-29 21:26 ` [PATCH] reiserfs: Check the return value from __getblk() Matthew Wilcox
2023-06-30  9:03   ` Christian Brauner
2023-07-04 18:49     ` Matthew Wilcox
2023-07-05  7:08       ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).