From patchwork Mon Mar 7 13:10:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jones X-Patchwork-Id: 6030 Return-path: Envelope-to: mchehab@pedra Delivery-date: Mon, 07 Mar 2011 10:12:20 -0300 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1PwaEW-0005zC-2K for mchehab@pedra; Mon, 07 Mar 2011 10:12:20 -0300 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Mon, 07 Mar 2011 10:12:19 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PwaDJ-0005fj-8T; Mon, 07 Mar 2011 13:11:05 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754502Ab1CGNKm (ORCPT + 1 other); Mon, 7 Mar 2011 08:10:42 -0500 Received: from mail1.matrix-vision.com ([78.47.19.71]:33106 "EHLO mail1.matrix-vision.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754415Ab1CGNKl (ORCPT ); Mon, 7 Mar 2011 08:10:41 -0500 Received: from mail1.matrix-vision.com (localhost [127.0.0.1]) by mail1.matrix-vision.com (Postfix) with ESMTP id 52D6172399; Mon, 7 Mar 2011 14:10:40 +0100 (CET) Received: from erinome (g2.matrix-vision.com [80.152.136.245]) by mail1.matrix-vision.com (Postfix) with ESMTPA id 17BC77221C; Mon, 7 Mar 2011 14:10:40 +0100 (CET) Received: from erinome (localhost [127.0.0.1]) by erinome (Postfix) with ESMTP id 725216F8A; Mon, 7 Mar 2011 14:10:39 +0100 (CET) Received: by erinome (Postfix, from userid 108) id 639956F9C; Mon, 7 Mar 2011 14:10:39 +0100 (CET) Received: from [192.168.65.46] (host65-46.intern.matrix-vision.de [192.168.65.46]) by erinome (Postfix) with ESMTPA id 4EE0B6F8A; Mon, 7 Mar 2011 14:10:39 +0100 (CET) Message-ID: <4D74D94F.7040702@matrix-vision.de> Date: Mon, 07 Mar 2011 14:10:39 +0100 From: Michael Jones User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101029 Lightning/1.0b2 Thunderbird/3.1.6 MIME-Version: 1.0 To: David Cohen CC: Hiroshi.DOYU@nokia.com, Laurent Pinchart , fernando.lugo@ti.com, Sakari Ailus , Linux Media Mailing List , linux-omap@vger.kernel.org Subject: [PATCH] omap: iommu: disallow mapping NULL address References: <4D6D219D.7020605@matrix-vision.de> <201103022018.23446.laurent.pinchart@ideasonboard.com> <4D6FBC7F.1080500@matrix-vision.de> <4D70F985.8030902@matrix-vision.de> In-Reply-To: X-MV-Disclaimer: true (erinome) X-AV-Checked: ClamAV using ClamSMTP (erinome) X-AV-Checked: ClamAV using ClamSMTP (mail1) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: From e7dbe4c4b64eb114f9b0804d6af3a3ca0e78acc8 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Mon, 7 Mar 2011 13:36:15 +0100 Subject: [PATCH] omap: iommu: disallow mapping NULL address commit c7f4ab26e3bcdaeb3e19ec658e3ad9092f1a6ceb allowed mapping the NULL address if da_start==0. Force da_start to exclude the first page. Signed-off-by: Michael Jones --- arch/arm/plat-omap/iommu.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c index 5990ea6..dcb5513 100644 --- a/arch/arm/plat-omap/iommu.c +++ b/arch/arm/plat-omap/iommu.c @@ -850,7 +850,7 @@ int iommu_set_da_range(struct iommu *obj, u32 start, u32 end) if (end < start || !PAGE_ALIGN(start | end)) return -EINVAL; - obj->da_start = start; + obj->da_start = max(start, (u32)PAGE_SIZE); obj->da_end = end; return 0; @@ -950,7 +950,9 @@ static int __devinit omap_iommu_probe(struct platform_device *pdev) obj->name = pdata->name; obj->dev = &pdev->dev; obj->ctx = (void *)obj + sizeof(*obj); - obj->da_start = pdata->da_start; + + /* reserve the first page for NULL */ + obj->da_start = max(pdata->da_start, (u32)PAGE_SIZE); obj->da_end = pdata->da_end; mutex_init(&obj->iommu_lock);