From patchwork Sun Sep 15 21:47:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Adami X-Patchwork-Id: 2894781 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 C3820BFF05 for ; Sun, 15 Sep 2013 21:48:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ECECE201F3 for ; Sun, 15 Sep 2013 21:48:05 +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 DAECF20171 for ; Sun, 15 Sep 2013 21:48:04 +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 1VLKAW-0005uS-EN; Sun, 15 Sep 2013 21:47:48 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VLKAU-0003lW-A6; Sun, 15 Sep 2013 21:47:46 +0000 Received: from mail-ee0-x22f.google.com ([2a00:1450:4013:c00::22f]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VLKAQ-0003kt-WC for linux-arm-kernel@lists.infradead.org; Sun, 15 Sep 2013 21:47:43 +0000 Received: by mail-ee0-f47.google.com with SMTP id d49so1619467eek.20 for ; Sun, 15 Sep 2013 14:47:20 -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=Dk1UixhtXBwUyw1o0hvXwr9Ae4cAXMF5xUnBOJ5tUy8=; b=FywI7aBKe2UNeiE8De2K/hWvAjt2JQIpMez5nIa3Pc1iL20d2oj83tyf+Ieubhy/KD gT6Z9J33Qyzsh3nV5TPFY6QyUS/A89LY2TmiYgUOL8RsBhIGVzG7nfRsyanO6+Qu5G4K tcBmk/37sp3EGq0Swy0VD5LmHEyVwFsBxX8wXBJrFY7ExXpGGowFkawtIwyIwGgFy+aL y14tgEBWF9Gtu/2xRabOXRq7EXh317+WDl9vjqMPQryBx3i0VvxJc/k3yycssuTrOTS+ +Y368XWNLX8Qkir0FK66AK3f5QLUpowvR7C02OwcDTHpG9SxQTJQjULyFbRKmgV5cQcH soEg== X-Received: by 10.14.4.1 with SMTP id 1mr38370059eei.21.1379281640571; Sun, 15 Sep 2013 14:47:20 -0700 (PDT) Received: from mizar.localdomain (host50-7-dynamic.20-79-r.retail.telecomitalia.it. [79.20.7.50]) by mx.google.com with ESMTPSA id j7sm36442178eeo.15.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 15 Sep 2013 14:47:19 -0700 (PDT) From: Andrea Adami To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2] ARM: pxa: sharpsl_param.c: fix invalid memory access Date: Sun, 15 Sep 2013 23:47:17 +0200 Message-Id: <1379281637-26854-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-20130915_174743_232057_E33DCBE5 X-CRM114-Status: GOOD ( 12.05 ) X-Spam-Score: -2.0 (--) Cc: Marko Katic , Russell King , Eric Miao , linux-kernel@vger.kernel.org, Haojian Zhuang 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). Signed-off-by: Marko Katic Signed-off-by: Andrea Adami --- arch/arm/common/sharpsl_param.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/arch/arm/common/sharpsl_param.c b/arch/arm/common/sharpsl_param.c index d56c932..ac886f2 100644 --- a/arch/arm/common/sharpsl_param.c +++ b/arch/arm/common/sharpsl_param.c @@ -23,9 +23,17 @@ * them early in the boot process, then pass them to the appropriate drivers. * Not all devices use all parameters but the format is common to all. */ + +/* NOTE: + * Zaurus PXA devices call sharpsl_save_param() during fixup so we need + * to translate the physical address. + * Zaurus collie (SA1100) is unaffected (function is called in init_machine). + */ + #ifdef CONFIG_ARCH_SA1100 #define PARAM_BASE 0xe8ffc000 #else +#include #define PARAM_BASE 0xa0000a00 #endif #define MAGIC_CHG(a,b,c,d) ( ( d << 24 ) | ( c << 16 ) | ( b << 8 ) | a ) @@ -41,7 +49,12 @@ EXPORT_SYMBOL(sharpsl_param); void sharpsl_save_param(void) { - memcpy(&sharpsl_param, (void *)PARAM_BASE, sizeof(struct sharpsl_param_info)); +#ifdef CONFIG_ARCH_SA1100 + void *param_start = (void *)PARAM_BASE; +#else + void *param_start = phys_to_virt(PARAM_BASE); +#endif + memcpy(&sharpsl_param, param_start, sizeof(struct sharpsl_param_info)); if (sharpsl_param.comadj_keyword != COMADJ_MAGIC) sharpsl_param.comadj=-1; @@ -58,5 +71,3 @@ void sharpsl_save_param(void) if (sharpsl_param.adadj_keyword != AD_MAGIC) sharpsl_param.adadj=-1; } - -