All of lore.kernel.org
 help / color / mirror / Atom feed
* [merged mm-hotfixes-stable] filemap-fix-the-conditional-folio_put-in-filemap_fault.patch removed from -mm tree
@ 2023-05-05 22:43 Andrew Morton
  2023-05-05 23:05 ` Matthew Wilcox
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2023-05-05 22:43 UTC (permalink / raw)
  To: mm-commits, willy, marc.dionne, jack, dhowells, hch, akpm


The quilt patch titled
     Subject: filemap: fix the conditional folio_put in filemap_fault
has been removed from the -mm tree.  Its filename was
     filemap-fix-the-conditional-folio_put-in-filemap_fault.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Christoph Hellwig <hch@lst.de>
Subject: filemap: fix the conditional folio_put in filemap_fault
Date: Wed, 3 May 2023 17:45:25 +0200

folio can't be NULL here now that __filemap_get_folio returns an ERR_PTR. 
Remove the conditional folio_put after the out_retry label and add a new
label for the cases where we have a valid folio.

Link: https://lkml.kernel.org/r/20230503154526.1223095-1-hch@lst.de
Fixes: 66dabbb65d67 ("mm: return an ERR_PTR from __filemap_get_folio")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: syzbot+48011b86c8ea329af1b9@syzkaller.appspotmail.com
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/filemap.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/mm/filemap.c~filemap-fix-the-conditional-folio_put-in-filemap_fault
+++ a/mm/filemap.c
@@ -3298,7 +3298,7 @@ retry_find:
 	}
 
 	if (!lock_folio_maybe_drop_mmap(vmf, folio, &fpin))
-		goto out_retry;
+		goto out_retry_put_folio;
 
 	/* Did it get truncated? */
 	if (unlikely(folio->mapping != mapping)) {
@@ -3334,7 +3334,7 @@ retry_find:
 	 */
 	if (fpin) {
 		folio_unlock(folio);
-		goto out_retry;
+		goto out_retry_put_folio;
 	}
 	if (mapping_locked)
 		filemap_invalidate_unlock_shared(mapping);
@@ -3363,7 +3363,7 @@ page_not_uptodate:
 	fpin = maybe_unlock_mmap_for_io(vmf, fpin);
 	error = filemap_read_folio(file, mapping->a_ops->read_folio, folio);
 	if (fpin)
-		goto out_retry;
+		goto out_retry_put_folio;
 	folio_put(folio);
 
 	if (!error || error == AOP_TRUNCATED_PAGE)
@@ -3372,14 +3372,14 @@ page_not_uptodate:
 
 	return VM_FAULT_SIGBUS;
 
+out_retry_put_folio:
+	folio_put(folio);
 out_retry:
 	/*
 	 * We dropped the mmap_lock, we need to return to the fault handler to
 	 * re-find the vma and come back and find our hopefully still populated
 	 * page.
 	 */
-	if (folio)
-		folio_put(folio);
 	if (mapping_locked)
 		filemap_invalidate_unlock_shared(mapping);
 	if (fpin)
_

Patches currently in -mm which might be from hch@lst.de are



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

* Re: [merged mm-hotfixes-stable] filemap-fix-the-conditional-folio_put-in-filemap_fault.patch removed from -mm tree
  2023-05-05 22:43 [merged mm-hotfixes-stable] filemap-fix-the-conditional-folio_put-in-filemap_fault.patch removed from -mm tree Andrew Morton
@ 2023-05-05 23:05 ` Matthew Wilcox
  2023-05-05 23:37   ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Wilcox @ 2023-05-05 23:05 UTC (permalink / raw)
  To: Andrew Morton; +Cc: mm-commits, marc.dionne, jack, dhowells, hch

On Fri, May 05, 2023 at 03:43:05PM -0700, Andrew Morton wrote:
> 
> The quilt patch titled
>      Subject: filemap: fix the conditional folio_put in filemap_fault
> has been removed from the -mm tree.  Its filename was
>      filemap-fix-the-conditional-folio_put-in-filemap_fault.patch
> 
> This patch was dropped because it was merged into the mm-hotfixes-stable branch
> of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

I thought i nacked this?

> ------------------------------------------------------
> From: Christoph Hellwig <hch@lst.de>
> Subject: filemap: fix the conditional folio_put in filemap_fault
> Date: Wed, 3 May 2023 17:45:25 +0200
> 
> folio can't be NULL here now that __filemap_get_folio returns an ERR_PTR. 
> Remove the conditional folio_put after the out_retry label and add a new
> label for the cases where we have a valid folio.
> 
> Link: https://lkml.kernel.org/r/20230503154526.1223095-1-hch@lst.de
> Fixes: 66dabbb65d67 ("mm: return an ERR_PTR from __filemap_get_folio")
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reported-by: syzbot+48011b86c8ea329af1b9@syzkaller.appspotmail.com
> Reviewed-by: Jan Kara <jack@suse.cz>
> Cc: Matthew Wilcox <willy@infradead.org>
> Cc: David Howells <dhowells@redhat.com>
> Cc: Marc Dionne <marc.dionne@auristor.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  mm/filemap.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> --- a/mm/filemap.c~filemap-fix-the-conditional-folio_put-in-filemap_fault
> +++ a/mm/filemap.c
> @@ -3298,7 +3298,7 @@ retry_find:
>  	}
>  
>  	if (!lock_folio_maybe_drop_mmap(vmf, folio, &fpin))
> -		goto out_retry;
> +		goto out_retry_put_folio;
>  
>  	/* Did it get truncated? */
>  	if (unlikely(folio->mapping != mapping)) {
> @@ -3334,7 +3334,7 @@ retry_find:
>  	 */
>  	if (fpin) {
>  		folio_unlock(folio);
> -		goto out_retry;
> +		goto out_retry_put_folio;
>  	}
>  	if (mapping_locked)
>  		filemap_invalidate_unlock_shared(mapping);
> @@ -3363,7 +3363,7 @@ page_not_uptodate:
>  	fpin = maybe_unlock_mmap_for_io(vmf, fpin);
>  	error = filemap_read_folio(file, mapping->a_ops->read_folio, folio);
>  	if (fpin)
> -		goto out_retry;
> +		goto out_retry_put_folio;
>  	folio_put(folio);
>  
>  	if (!error || error == AOP_TRUNCATED_PAGE)
> @@ -3372,14 +3372,14 @@ page_not_uptodate:
>  
>  	return VM_FAULT_SIGBUS;
>  
> +out_retry_put_folio:
> +	folio_put(folio);
>  out_retry:
>  	/*
>  	 * We dropped the mmap_lock, we need to return to the fault handler to
>  	 * re-find the vma and come back and find our hopefully still populated
>  	 * page.
>  	 */
> -	if (folio)
> -		folio_put(folio);
>  	if (mapping_locked)
>  		filemap_invalidate_unlock_shared(mapping);
>  	if (fpin)
> _
> 
> Patches currently in -mm which might be from hch@lst.de are
> 
> 

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

* Re: [merged mm-hotfixes-stable] filemap-fix-the-conditional-folio_put-in-filemap_fault.patch removed from -mm tree
  2023-05-05 23:05 ` Matthew Wilcox
@ 2023-05-05 23:37   ` Andrew Morton
  2023-05-05 23:42     ` Matthew Wilcox
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2023-05-05 23:37 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: mm-commits, marc.dionne, jack, dhowells, hch

On Sat, 6 May 2023 00:05:57 +0100 Matthew Wilcox <willy@infradead.org> wrote:

> On Fri, May 05, 2023 at 03:43:05PM -0700, Andrew Morton wrote:
> > 
> > The quilt patch titled
> >      Subject: filemap: fix the conditional folio_put in filemap_fault
> > has been removed from the -mm tree.  Its filename was
> >      filemap-fix-the-conditional-folio_put-in-filemap_fault.patch
> > 
> > This patch was dropped because it was merged into the mm-hotfixes-stable branch
> > of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> 
> I thought i nacked this?

This? https://lkml.kernel.org/r/ZFMn0zGC58KtQw6N@casper.infradead.org

I interpret that as "doh, never mind"?

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

* Re: [merged mm-hotfixes-stable] filemap-fix-the-conditional-folio_put-in-filemap_fault.patch removed from -mm tree
  2023-05-05 23:37   ` Andrew Morton
@ 2023-05-05 23:42     ` Matthew Wilcox
  2023-05-06  1:04       ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Wilcox @ 2023-05-05 23:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: mm-commits, marc.dionne, jack, dhowells, hch

On Fri, May 05, 2023 at 04:37:27PM -0700, Andrew Morton wrote:
> On Sat, 6 May 2023 00:05:57 +0100 Matthew Wilcox <willy@infradead.org> wrote:
> 
> > On Fri, May 05, 2023 at 03:43:05PM -0700, Andrew Morton wrote:
> > > 
> > > The quilt patch titled
> > >      Subject: filemap: fix the conditional folio_put in filemap_fault
> > > has been removed from the -mm tree.  Its filename was
> > >      filemap-fix-the-conditional-folio_put-in-filemap_fault.patch
> > > 
> > > This patch was dropped because it was merged into the mm-hotfixes-stable branch
> > > of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> > 
> > I thought i nacked this?
> 
> This? https://lkml.kernel.org/r/ZFMn0zGC58KtQw6N@casper.infradead.org
> 
> I interpret that as "doh, never mind"?

This patch is what I want to see merged:

diff --git a/mm/filemap.c b/mm/filemap.c
index a34abfe8c654..b4c9bd368b7e 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3378,7 +3378,7 @@ vm_fault_t filemap_fault(struct vm_fault *vmf)
 	 * re-find the vma and come back and find our hopefully still populated
 	 * page.
 	 */
-	if (folio)
+	if (!IS_ERR(folio))
 		folio_put(folio);
 	if (mapping_locked)
 		filemap_invalidate_unlock_shared(mapping);

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

* Re: [merged mm-hotfixes-stable] filemap-fix-the-conditional-folio_put-in-filemap_fault.patch removed from -mm tree
  2023-05-05 23:42     ` Matthew Wilcox
@ 2023-05-06  1:04       ` Andrew Morton
  2023-05-06  2:28         ` Matthew Wilcox
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2023-05-06  1:04 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: mm-commits, marc.dionne, jack, dhowells, hch

On Sat, 6 May 2023 00:42:36 +0100 Matthew Wilcox <willy@infradead.org> wrote:

> On Fri, May 05, 2023 at 04:37:27PM -0700, Andrew Morton wrote:
> > On Sat, 6 May 2023 00:05:57 +0100 Matthew Wilcox <willy@infradead.org> wrote:
> > 
> > > On Fri, May 05, 2023 at 03:43:05PM -0700, Andrew Morton wrote:
> > > > 
> > > > The quilt patch titled
> > > >      Subject: filemap: fix the conditional folio_put in filemap_fault
> > > > has been removed from the -mm tree.  Its filename was
> > > >      filemap-fix-the-conditional-folio_put-in-filemap_fault.patch
> > > > 
> > > > This patch was dropped because it was merged into the mm-hotfixes-stable branch
> > > > of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> > > 
> > > I thought i nacked this?
> > 
> > This? https://lkml.kernel.org/r/ZFMn0zGC58KtQw6N@casper.infradead.org
> > 
> > I interpret that as "doh, never mind"?
> 
> This patch is what I want to see merged:
>
> ...
>
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -3378,7 +3378,7 @@ vm_fault_t filemap_fault(struct vm_fault *vmf)
>  	 * re-find the vma and come back and find our hopefully still populated
>  	 * page.
>  	 */
> -	if (folio)
> +	if (!IS_ERR(folio))
>  		folio_put(folio);
>  	if (mapping_locked)
>  		filemap_invalidate_unlock_shared(mapping);

Oh.  And hch preferred the label approach.  I'll stick with the patch
as-is.  Please send an alteration if you feel sufficiently strongly
about it.


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

* Re: [merged mm-hotfixes-stable] filemap-fix-the-conditional-folio_put-in-filemap_fault.patch removed from -mm tree
  2023-05-06  1:04       ` Andrew Morton
@ 2023-05-06  2:28         ` Matthew Wilcox
  0 siblings, 0 replies; 6+ messages in thread
From: Matthew Wilcox @ 2023-05-06  2:28 UTC (permalink / raw)
  To: Andrew Morton; +Cc: mm-commits, marc.dionne, jack, dhowells, hch

On Fri, May 05, 2023 at 06:04:13PM -0700, Andrew Morton wrote:
> On Sat, 6 May 2023 00:42:36 +0100 Matthew Wilcox <willy@infradead.org> wrote:
> > This patch is what I want to see merged:
> 
> Oh.  And hch preferred the label approach.  I'll stick with the patch
> as-is.  Please send an alteration if you feel sufficiently strongly
> about it.

I'm supposed to be the maintainer.  My preference trumps Christoph's.


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

end of thread, other threads:[~2023-05-06  2:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-05 22:43 [merged mm-hotfixes-stable] filemap-fix-the-conditional-folio_put-in-filemap_fault.patch removed from -mm tree Andrew Morton
2023-05-05 23:05 ` Matthew Wilcox
2023-05-05 23:37   ` Andrew Morton
2023-05-05 23:42     ` Matthew Wilcox
2023-05-06  1:04       ` Andrew Morton
2023-05-06  2:28         ` Matthew Wilcox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.