From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-Id: <20130507035855.676415514@goodmis.org> Date: Mon, 06 May 2013 23:58:40 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: David Woodhouse Subject: [088/126] mtd: Disable mtdchar mmap on MMU systems References: <20130507035712.909872333@goodmis.org> Content-Disposition: inline; filename=0088-mtd-Disable-mtdchar-mmap-on-MMU-systems.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: 3.6.11.3 stable review patch. If anyone has any objections, please let me know. ------------------ From: David Woodhouse [ Upstream commit f5cf8f07423b2677cebebcebc863af77223a4972 ] 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 Signed-off-by: Steven Rostedt --- 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 a6e7451..76afcb4 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c @@ -1162,7 +1162,11 @@ static int mtdchar_mmap(struct file *file, struct vm_area_struct *vma) resource_size_t start, off; unsigned long len, vma_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 = get_vm_offset(vma); start = map->phys; len = PAGE_ALIGN((start & ~PAGE_MASK) + map->size); -- 1.7.10.4