From patchwork Wed Sep 18 23:18:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Adami X-Patchwork-Id: 2909711 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 71F739F1E1 for ; Wed, 18 Sep 2013 23:19:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 918FA20411 for ; Wed, 18 Sep 2013 23:19:30 +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 6D8DA203E1 for ; Wed, 18 Sep 2013 23:19:29 +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 1VMR1e-0002o9-Al; Wed, 18 Sep 2013 23:19:14 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VMR1c-0001Ef-57; Wed, 18 Sep 2013 23:19:12 +0000 Received: from mail-ee0-x22d.google.com ([2a00:1450:4013:c00::22d]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VMR1Z-0001DZ-Mr for linux-arm-kernel@lists.infradead.org; Wed, 18 Sep 2013 23:19:10 +0000 Received: by mail-ee0-f45.google.com with SMTP id c50so3792576eek.18 for ; Wed, 18 Sep 2013 16:18:46 -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=VvL85mEj68VkIyBHWB1uEwwEH+Lv/NtOdgLitbSO8Yw=; b=FDAFROsbdfKcu0d5gE3Eqw9hqWn6X94BItxDQIMzdF5ZZ+aQ8YjxDyCdntqmKMyruf feGQmTJLWOTyyKu8jSIa94bilKed2RxfBdwFbB7Zengh30oHPwf33otX+ig3eE9bnFjP lz34GFdbhiKotEm0Ie5yPmBK187DsKgw9499fk82oZttIACXPaK0hsHBU82RnlKNlX3M ux8Cm7lIea/q81xVhndey26iRZB/viSEYbaQCJPKiEcIlPhra/qzzYsASxCONq9jh3wl 3+fALwoxqkpFinUXDNg4k8u74am6sK7nzbWjg4bihWDjxSOVj5w2gAh4mnd0SCpU2pe7 8wCQ== X-Received: by 10.14.221.8 with SMTP id q8mr73450eep.78.1379546326665; Wed, 18 Sep 2013 16:18:46 -0700 (PDT) Received: from mizar.localdomain (host77-44-dynamic.54-79-r.retail.telecomitalia.it. [79.54.44.77]) by mx.google.com with ESMTPSA id d8sm6731049eeh.8.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Sep 2013 16:18:46 -0700 (PDT) From: Andrea Adami To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v3] ARM: pxa: sharpsl_param.c: fix invalid memory access Date: Thu, 19 Sep 2013 01:18:39 +0200 Message-Id: <1379546319-29165-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-20130918_191909_864935_3C1B8701 X-CRM114-Status: GOOD ( 13.55 ) X-Spam-Score: -2.0 (--) 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). 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..4dcd349 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, @@ -23,6 +24,8 @@ * 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. */ + + #ifdef CONFIG_ARCH_SA1100 #define PARAM_BASE 0xe8ffc000 #else @@ -41,7 +44,17 @@ EXPORT_SYMBOL(sharpsl_param); void sharpsl_save_param(void) { - memcpy(&sharpsl_param, (void *)PARAM_BASE, sizeof(struct sharpsl_param_info)); +/* NOTE: + * Zaurus PXA devices call sharpsl_save_param() during fixup and the MMU + * is setup so we need to translate the physical address. + * Zaurus collie (SA1100) is unaffected (function is called in init_machine). + */ +#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; } - -