linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]fix page release issue in filemap_fault
@ 2007-10-08 15:28 Yan Zheng
  2007-10-08 17:15 ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: Yan Zheng @ 2007-10-08 15:28 UTC (permalink / raw)
  To: linux-mm, linux-kernel, akpm

Hi all

find_lock_page increases page's usage count, we should decrease it
before return VM_FAULT_SIGBUS

Signed-off-by: Yan Zheng<yanzheng@21cn.com>
----
diff -ur linux-2.6.23-rc9/mm/filemap.c linux/mm/filemap.c
--- linux-2.6.23-rc9/mm/filemap.c	2007-10-07 15:03:33.000000000 +0800
+++ linux/mm/filemap.c	2007-10-08 23:14:39.000000000 +0800
@@ -1388,6 +1388,7 @@
 	size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
 	if (unlikely(vmf->pgoff >= size)) {
 		unlock_page(page);
+		page_cache_release(page);
 		goto outside_data_content;
 	}

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH]fix page release issue in filemap_fault
  2007-10-08 15:28 [PATCH]fix page release issue in filemap_fault Yan Zheng
@ 2007-10-08 17:15 ` Peter Zijlstra
  2007-10-08 17:23   ` Rik van Riel
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2007-10-08 17:15 UTC (permalink / raw)
  To: Yan Zheng; +Cc: linux-mm, linux-kernel, akpm

On Mon, 2007-10-08 at 23:28 +0800, Yan Zheng wrote:
> Hi all
> 
> find_lock_page increases page's usage count, we should decrease it
> before return VM_FAULT_SIGBUS
> 
> Signed-off-by: Yan Zheng<yanzheng@21cn.com>

Nice catch, .23 material?

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>

> ----
> diff -ur linux-2.6.23-rc9/mm/filemap.c linux/mm/filemap.c
> --- linux-2.6.23-rc9/mm/filemap.c	2007-10-07 15:03:33.000000000 +0800
> +++ linux/mm/filemap.c	2007-10-08 23:14:39.000000000 +0800
> @@ -1388,6 +1388,7 @@
>  	size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
>  	if (unlikely(vmf->pgoff >= size)) {
>  		unlock_page(page);
> +		page_cache_release(page);
>  		goto outside_data_content;
>  	}

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH]fix page release issue in filemap_fault
  2007-10-08 17:15 ` Peter Zijlstra
@ 2007-10-08 17:23   ` Rik van Riel
  0 siblings, 0 replies; 3+ messages in thread
From: Rik van Riel @ 2007-10-08 17:23 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Yan Zheng, linux-mm, linux-kernel, akpm

On Mon, 08 Oct 2007 19:15:23 +0200
Peter Zijlstra <peterz@infradead.org> wrote:
> On Mon, 2007-10-08 at 23:28 +0800, Yan Zheng wrote:
> > Hi all
> > 
> > find_lock_page increases page's usage count, we should decrease it
> > before return VM_FAULT_SIGBUS
> > 
> > Signed-off-by: Yan Zheng<yanzheng@21cn.com>
> 
> Nice catch, .23 material?

An obvious fix for a memory leak.  I think it should go in.

> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>

Acked-by: Rik van Riel <riel@redhat.com>

-- 
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2007-10-08 17:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-08 15:28 [PATCH]fix page release issue in filemap_fault Yan Zheng
2007-10-08 17:15 ` Peter Zijlstra
2007-10-08 17:23   ` Rik van Riel

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).