[3.5.y.z,extended,stable] Patch "mtd: Disable mtdchar mmap on MMU systems" has been added to staging queue

Message ID 1366622698-6396-1-git-send-email-luis.henriques@canonical.com
State New
Headers show

Commit Message

Luis Henriques April 22, 2013, 9:24 a.m.
This is a note to let you know that I have just added a patch titled

    mtd: Disable mtdchar mmap on MMU systems

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:


If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see



From f9ec14f993e133ddaf5e760d6ddf70408435ebcd Mon Sep 17 00:00:00 2001
From: David Woodhouse <David.Woodhouse@intel.com>
Date: Tue, 9 Oct 2012 15:08:10 +0100
Subject: [PATCH] mtd: Disable mtdchar mmap on MMU systems

commit f5cf8f07423b2677cebebcebc863af77223a4972 upstream.

This code was broken because it assumed that all MTD devices were map-based.
Disable it for now, until it can be fixed properly for the next merge window.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
[ luis: adjust context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
 drivers/mtd/mtdchar.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)



diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index f2f482b..2cfb1a8 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -1136,7 +1136,11 @@  static int mtdchar_mmap(struct file *file, struct vm_area_struct *vma)
 	unsigned long off;
 	u32 len;

-	if (mtd->type == MTD_RAM || mtd->type == MTD_ROM) {
+        /* This is broken because it assumes the MTD device is map-based
+	   and that mtd->priv is a valid struct map_info.  It should be
+	   replaced with something that uses the mtd_get_unmapped_area()
+	   operation properly. */
+	if (0 /*mtd->type == MTD_RAM || mtd->type == MTD_ROM*/) {
 		off = vma->vm_pgoff << PAGE_SHIFT;
 		start = map->phys;
 		len = PAGE_ALIGN((start & ~PAGE_MASK) + map->size);