From: Nick Piggin <npiggin@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>,
Badari Pulavarty <pbadari@us.ibm.com>
Cc: Linux Memory Management List <linux-mm@kvack.org>
Subject: [patch] mm: fix madvise infinine loop
Date: Sat, 10 Mar 2007 04:49:42 +0100 [thread overview]
Message-ID: <20070310034942.GB13299@wotan.suse.de> (raw)
Hi,
This has been noticed when running a particular database server which I
won't name. Please apply.
--
madvise(MADV_REMOVE) can go into an infinite loop or cause an oops if
the call covers a region from the start of a vma, and extending past that
vma.
Signed-off-by: Nick Piggin <npiggin@suse.de>
Index: linux-2.6.16/mm/madvise.c
===================================================================
--- linux-2.6.16.orig/mm/madvise.c
+++ linux-2.6.16/mm/madvise.c
@@ -155,11 +155,14 @@ static long madvise_dontneed(struct vm_a
* Other filesystems return -ENOSYS.
*/
static long madvise_remove(struct vm_area_struct *vma,
+ struct vm_area_struct **prev,
unsigned long start, unsigned long end)
{
struct address_space *mapping;
loff_t offset, endoff;
+ *prev = vma;
+
if (vma->vm_flags & (VM_LOCKED|VM_NONLINEAR|VM_HUGETLB))
return -EINVAL;
@@ -199,7 +202,7 @@ madvise_vma(struct vm_area_struct *vma,
error = madvise_behavior(vma, prev, start, end, behavior);
break;
case MADV_REMOVE:
- error = madvise_remove(vma, start, end);
+ error = madvise_remove(vma, prev, start, end);
break;
case MADV_WILLNEED:
--
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>
next reply other threads:[~2007-03-10 3:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-10 3:49 Nick Piggin [this message]
2007-03-15 19:49 ` Hugh Dickins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070310034942.GB13299@wotan.suse.de \
--to=npiggin@suse.de \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=pbadari@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox