linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <khlebnikov@openvz.org>
To: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Cc: Sasha Levin <levinsasha928@gmail.com>
Subject: [PATCH] mm: fix null vm_ops dereference in sys_remap_file_pages
Date: Thu, 11 Oct 2012 14:18:34 +0400	[thread overview]
Message-ID: <20121011101834.1793.7213.stgit@zurg> (raw)
In-Reply-To: <5074ACDA.2060705@gmail.com>

This fixes bug introduced in commit "mm: kill vma flag VM_CAN_NONLINEAR",
vma->vm_ops must be checked before checking vm_ops->remap_pages.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Reported-by: Sasha Levin <levinsasha928@gmail.com>
---
 mm/fremap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/fremap.c b/mm/fremap.c
index 3899a86..a0aaf0e 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -169,7 +169,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
 	if (vma->vm_private_data && !(vma->vm_flags & VM_NONLINEAR))
 		goto out;
 
-	if (!vma->vm_ops->remap_pages)
+	if (!vma->vm_ops || !vma->vm_ops->remap_pages)
 		goto out;
 
 	if (start < vma->vm_start || start + size > vma->vm_end)


  reply	other threads:[~2012-10-11 10:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-31 10:41 [PATCH RESEND v3 00/10] mm: vma->vm_flags diet Konstantin Khlebnikov
2012-07-31 10:41 ` [PATCH v3 01/10] x86, pat: remove the dependency on 'vm_pgoff' in track/untrack pfn vma routines Konstantin Khlebnikov
2012-07-31 10:42 ` [PATCH v3 02/10] x86, pat: separate the pfn attribute tracking for remap_pfn_range and vm_insert_pfn Konstantin Khlebnikov
2012-07-31 10:42 ` [PATCH v3 03/10] mm, x86, pat: rework linear pfn-mmap tracking Konstantin Khlebnikov
2012-07-31 10:42 ` [PATCH v3 04/10] mm: introduce arch-specific vma flag VM_ARCH_1 Konstantin Khlebnikov
2012-07-31 10:42 ` [PATCH v3 05/10] mm: kill vma flag VM_INSERTPAGE Konstantin Khlebnikov
2012-07-31 10:42 ` [PATCH v3 06/10] mm: kill vma flag VM_CAN_NONLINEAR Konstantin Khlebnikov
2012-10-09 23:01   ` Sasha Levin
2012-10-11 10:18     ` Konstantin Khlebnikov [this message]
2012-07-31 10:42 ` [PATCH v3 07/10] mm: use mm->exe_file instead of first VM_EXECUTABLE vma->vm_file Konstantin Khlebnikov
2012-08-01  1:34   ` James Morris
2012-07-31 10:42 ` [PATCH v3 08/10] mm: kill vma flag VM_EXECUTABLE and mm->num_exe_file_vmas Konstantin Khlebnikov
2012-07-31 10:42 ` [PATCH v3 09/10] mm: prepare VM_DONTDUMP for using in drivers Konstantin Khlebnikov
2012-07-31 10:42 ` [PATCH v3 10/10] mm: kill vma flag VM_RESERVED and mm->reserved_vm counter Konstantin Khlebnikov
2012-10-09 10:02   ` Eric Dumazet
2012-10-09 12:12     ` Linus Torvalds
2012-10-09 14:21       ` Alex Williamson
2012-10-09 23:00         ` Alex Williamson
2012-10-10  4:06           ` Alex Williamson
2012-07-31 16:31 ` [PATCH RESEND v3 00/10] mm: vma->vm_flags diet Linus Torvalds

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=20121011101834.1793.7213.stgit@zurg \
    --to=khlebnikov@openvz.org \
    --cc=akpm@linux-foundation.org \
    --cc=levinsasha928@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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).