linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
Cc: Davidlohr Bueso <davidlohr@hp.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux MM <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Rik van Riel <riel@redhat.com>,
	Michel Lespinasse <walken@google.com>,
	Hugh Dickins <hughd@google.com>
Subject: [PATCH] vmacache: change vmacache_find() to always check ->vm_mm
Date: Tue, 29 Apr 2014 14:52:55 +0200	[thread overview]
Message-ID: <20140429125255.GA13934@redhat.com> (raw)
In-Reply-To: <535F78A8.80403@linux.vnet.ibm.com>

On 04/29, Srivatsa S. Bhat wrote:
>
> I guess I'll hold off on testing this fix until I get to reproduce
> the bug more reliably..

perhaps the patch below can help a bit?

-------------------------------------------------------------------------------
Subject: [PATCH] vmacache: change vmacache_find() to always check ->vm_mm

If ->vmacache was corrupted it would be better to detect and report
the problem asap, check vma->vm_mm before vm_start/vm_end.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 mm/vmacache.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/vmacache.c b/mm/vmacache.c
index d4224b3..952a324 100644
--- a/mm/vmacache.c
+++ b/mm/vmacache.c
@@ -81,9 +81,10 @@ struct vm_area_struct *vmacache_find(struct mm_struct *mm, unsigned long addr)
 	for (i = 0; i < VMACACHE_SIZE; i++) {
 		struct vm_area_struct *vma = current->vmacache[i];
 
-		if (vma && vma->vm_start <= addr && vma->vm_end > addr) {
+		if (vma) {
 			BUG_ON(vma->vm_mm != mm);
-			return vma;
+			if (vma->vm_start <= addr && vma->vm_end > addr)
+				return vma;
 		}
 	}
 
-- 
1.5.5.1


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

  reply	other threads:[~2014-04-29 12:53 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-28 19:18 [BUG] kernel BUG at mm/vmacache.c:85! Srivatsa S. Bhat
2014-04-28 19:20 ` Srivatsa S. Bhat
2014-04-28 21:20 ` Linus Torvalds
2014-04-28 21:55   ` Linus Torvalds
2014-04-28 22:05     ` Hugh Dickins
2014-04-28 22:14       ` Davidlohr Bueso
2014-04-28 22:25         ` Linus Torvalds
2014-04-29  9:59           ` Srivatsa S. Bhat
2014-04-30 19:16             ` Srivatsa S. Bhat
2014-04-30 19:18               ` Srivatsa S. Bhat
2014-04-30 19:20                 ` Srivatsa S. Bhat
2014-04-30 20:26               ` Linus Torvalds
2014-05-01  3:56               ` Hugh Dickins
2014-04-28 22:39     ` Davidlohr Bueso
2014-04-28 22:58       ` Linus Torvalds
2014-04-28 23:11         ` Andrew Morton
2014-04-28 23:57           ` Linus Torvalds
2014-04-29  0:11             ` Davidlohr Bueso
2014-04-29 10:02               ` Srivatsa S. Bhat
2014-04-29 12:52                 ` Oleg Nesterov [this message]
2014-04-29 13:09                   ` [PATCH] vmacache: change vmacache_find() to always check ->vm_mm Srivatsa S. Bhat
2014-04-29 14:02                     ` Oleg Nesterov
2014-04-29 12:40               ` [BUG] kernel BUG at mm/vmacache.c:85! Oleg Nesterov
2014-04-29  8:02       ` Srivatsa S. Bhat
2014-04-29  7:59     ` Srivatsa S. Bhat
2014-04-29  0:00 ` Dave Jones
2014-04-29  8:21   ` Srivatsa S. Bhat

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=20140429125255.GA13934@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=davidlohr@hp.com \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@redhat.com \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=torvalds@linux-foundation.org \
    --cc=walken@google.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;
as well as URLs for NNTP newsgroup(s).