From patchwork Fri Sep 20 20:35:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Adami X-Patchwork-Id: 2921471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BC119BFF05 for ; Fri, 20 Sep 2013 20:36:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 04FF7200D9 for ; Fri, 20 Sep 2013 20:36:12 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 18C3F200CF for ; Fri, 20 Sep 2013 20:36:11 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VN7Qu-0007UG-Br; Fri, 20 Sep 2013 20:36:08 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VN7Qr-0004vQ-Tp; Fri, 20 Sep 2013 20:36:05 +0000 Received: from mail-ea0-f171.google.com ([209.85.215.171]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VN7Qm-0004uP-S6 for linux-arm-kernel@lists.infradead.org; Fri, 20 Sep 2013 20:36:02 +0000 Received: by mail-ea0-f171.google.com with SMTP id n15so501746ead.30 for ; Fri, 20 Sep 2013 13:35:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=2Utch9BzvtUR0peuAtzdT0h9oQqnsSxd2GKVWcqF01g=; b=FYFZRJIBTUurtUpLLtcQuieIef9uP/YqhjZhi1RY95igtO+OIyLQ4R49gVJa8bgzn6 zzZ42HsY3OIzp3dyGsAPtJd7k/P+FDnRCFDH4OOs6JevtNsyZZ8bTtxwQqsLam1aaci1 nMWCKoZkWpMflSZITqAtD/nxR987Eb1iw5TdfhT9MJt9QLMWFDEwlnsRies/Ih40ijAe kkmVUjjAHTlf2XvGINIp5mAB3Zd5NLEKm5prAmOg1Z0akSag6f2u1Fl/sOQu1PhSUEwe XcYNan3ux53kFMpgCx+19+HFID3z5/m/pG05RNU6mXaDJkm3jH+3tSACjU/kEbVQkSp8 XiWg== X-Received: by 10.15.98.194 with SMTP id bj42mr13380381eeb.12.1379709329389; Fri, 20 Sep 2013 13:35:29 -0700 (PDT) Received: from mizar.localdomain (host54-232-dynamic.11-79-r.retail.telecomitalia.it. [79.11.232.54]) by mx.google.com with ESMTPSA id j7sm22034516eeo.15.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Sep 2013 13:35:28 -0700 (PDT) From: Andrea Adami To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v4] sharpsl_param.c: ARM: pxa: fix invalid memory access Date: Fri, 20 Sep 2013 22:35:26 +0200 Message-Id: <1379709326-2988-1-git-send-email-andrea.adami@gmail.com> X-Mailer: git-send-email 1.8.1.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130920_163601_363643_7F8ABD4C X-CRM114-Status: GOOD ( 11.89 ) X-Spam-Score: -2.7 (--) Cc: Olof Johansson , Marko Katic , arm@kernel.org, Russell King , linux-kernel@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP After commit 72662e01088394577be4a3f14da94cf87bea2591 ARM: head.S: only include __turn_mmu_on in the initial identity mapping Zaurus PXA devices call sharpsl_save_param() during fixup and hang on boot because memcpy refers to physical addresses no longer valid if the MMU is setup. Zaurus collie (SA1100) is unaffected (function is called in init_machine). The code was making assumptions and for PXA the virtual address should have been used before. Signed-off-by: Marko Katic Signed-off-by: Andrea Adami --- arch/arm/common/sharpsl_param.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/common/sharpsl_param.c b/arch/arm/common/sharpsl_param.c index d56c932..3490549 100644 --- a/arch/arm/common/sharpsl_param.c +++ b/arch/arm/common/sharpsl_param.c @@ -15,6 +15,7 @@ #include #include #include +#include /* * Certain hardware parameters determined at the time of device manufacture, @@ -25,8 +26,10 @@ */ #ifdef CONFIG_ARCH_SA1100 #define PARAM_BASE 0xe8ffc000 +#define param_start(x) (void *)(x) #else #define PARAM_BASE 0xa0000a00 +#define param_start(x) __va(x) #endif #define MAGIC_CHG(a,b,c,d) ( ( d << 24 ) | ( c << 16 ) | ( b << 8 ) | a ) @@ -41,7 +44,7 @@ EXPORT_SYMBOL(sharpsl_param); void sharpsl_save_param(void) { - memcpy(&sharpsl_param, (void *)PARAM_BASE, sizeof(struct sharpsl_param_info)); + memcpy(&sharpsl_param, param_start(PARAM_BASE), sizeof(struct sharpsl_param_info)); if (sharpsl_param.comadj_keyword != COMADJ_MAGIC) sharpsl_param.comadj=-1;