From patchwork Thu Sep 13 02:40:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Liu X-Patchwork-Id: 1449941 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 30C25DF238 for ; Thu, 13 Sep 2012 02:41:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752750Ab2IMClJ (ORCPT ); Wed, 12 Sep 2012 22:41:09 -0400 Received: from ch1ehsobe001.messaging.microsoft.com ([216.32.181.181]:46821 "EHLO ch1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751373Ab2IMClI (ORCPT ); Wed, 12 Sep 2012 22:41:08 -0400 Received: from mail49-ch1-R.bigfish.com (10.43.68.241) by CH1EHSOBE011.bigfish.com (10.43.70.61) with Microsoft SMTP Server id 14.1.225.23; Thu, 13 Sep 2012 02:41:07 +0000 Received: from mail49-ch1 (localhost [127.0.0.1]) by mail49-ch1-R.bigfish.com (Postfix) with ESMTP id 1877910005C; Thu, 13 Sep 2012 02:41:07 +0000 (UTC) X-Forefront-Antispam-Report: CIP:137.71.25.55; KIP:(null); UIP:(null); IPV:NLI; H:nwd2mta1.analog.com; RD:nwd2mail10.analog.com; EFVD:NLI X-SpamScore: 20 X-BigFish: VS20(zzd6f1izz1ce5h1202h1d1ah1cabh1d2ahzz8275bhz2ei87h2a8h668h839hd24he5bhe96h107ah1288h12a5h12bdh12e5hff4o129fs1151h1155h) Received-SPF: neutral (mail49-ch1: 137.71.25.55 is neither permitted nor denied by domain of gmail.com) client-ip=137.71.25.55; envelope-from=lliubbo@gmail.com; helo=nwd2mta1.analog.com ; 1.analog.com ; X-FB-DOMAIN-IP-MATCH: fail Received: from mail49-ch1 (localhost.localdomain [127.0.0.1]) by mail49-ch1 (MessageSwitch) id 1347504065656540_4578; Thu, 13 Sep 2012 02:41:05 +0000 (UTC) Received: from CH1EHSMHS041.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.246]) by mail49-ch1.bigfish.com (Postfix) with ESMTP id 9D01B12006A; Thu, 13 Sep 2012 02:41:05 +0000 (UTC) Received: from nwd2mta1.analog.com (137.71.25.55) by CH1EHSMHS041.bigfish.com (10.43.69.250) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 13 Sep 2012 02:41:04 +0000 Received: from NWD2HUBCAS2.ad.analog.com (nwd2hubcas2.ad.analog.com [10.64.73.30]) by nwd2mta1.analog.com (8.13.8/8.13.8) with ESMTP id q8D2f4lr018656 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Wed, 12 Sep 2012 19:41:04 -0700 Received: from zeus.spd.analog.com (10.64.82.11) by NWD2HUBCAS2.ad.analog.com (10.64.73.30) with Microsoft SMTP Server id 8.3.83.0; Wed, 12 Sep 2012 22:41:03 -0400 Received: from linux.site ([10.99.22.20]) by zeus.spd.analog.com (8.14.5/8.14.5) with ESMTP id q8D2f0QH016348; Wed, 12 Sep 2012 22:41:00 -0400 Received: from bob-OptiPlex-760.analog.com (unknown [10.99.24.84]) by linux.site (Postfix) with ESMTP id 160D34271060; Wed, 12 Sep 2012 13:07:51 -0600 (MDT) From: Bob Liu To: CC: , , , , , , , , , , Bob Liu Subject: [PATCH] nommu: remap_pfn_range: fix addr parameter check Date: Thu, 13 Sep 2012 10:40:57 +0800 Message-ID: <1347504057-5612-1-git-send-email-lliubbo@gmail.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The addr parameter may not page aligned eg. when it's come from vfb_mmap():vma->vm_start in video driver. This patch fix the check in remap_pfn_range() else some driver like v4l2 will fail in this function while calling mmap() on nommu arch like blackfin and st. Reported-by: Bhupesh SHARMA Reported-by: Scott Jiang Signed-off-by: Bob Liu --- mm/nommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/nommu.c b/mm/nommu.c index d4b0c10..5d6068b 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -1819,7 +1819,7 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address, int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn, unsigned long size, pgprot_t prot) { - if (addr != (pfn << PAGE_SHIFT)) + if ((addr & PAGE_MASK) != (pfn << PAGE_SHIFT)) return -EINVAL; vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;