linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pxa: sharpsl_param: fix invalid memory access in sharpsl_save_param()
@ 2013-07-20 23:07 Andrea Adami
  2013-08-22 11:38 ` Andrea Adami
  0 siblings, 1 reply; 2+ messages in thread
From: Andrea Adami @ 2013-07-20 23:07 UTC (permalink / raw)
  To: linux-arm-kernel

From: Marko Katic <dromede@gmail.com>

Unbreak kernel boot (tested with kexecboot)

Patch was sent twice upstrream:
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-December/137284.html
Devices that call sharpsl_save_param() will hang on boot due to
a memcpy call that uses a physical address that is no longer * accessible. Fix
his by converting the physical address into a virtual one.

Signed-off-by: Marko Katic <dromede@gmail.com>
[andrea.adami at gmail.com: checkpatch.pl dislikes void * param_start]
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
---
 arch/arm/common/sharpsl_param.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/common/sharpsl_param.c b/arch/arm/common/sharpsl_param.c
index d56c932..b70b13a 100644
--- a/arch/arm/common/sharpsl_param.c
+++ b/arch/arm/common/sharpsl_param.c
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/string.h>
+#include <asm/memory.h>
 #include <asm/mach/sharpsl_param.h>
 
 /*
@@ -41,7 +42,8 @@ EXPORT_SYMBOL(sharpsl_param);
 
 void sharpsl_save_param(void)
 {
-	memcpy(&sharpsl_param, (void *)PARAM_BASE, sizeof(struct sharpsl_param_info));
+	void *param_start = phys_to_virt(PARAM_BASE);
+	memcpy(&sharpsl_param, param_start, sizeof(struct sharpsl_param_info));
 
 	if (sharpsl_param.comadj_keyword != COMADJ_MAGIC)
 		sharpsl_param.comadj=-1;
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] pxa: sharpsl_param: fix invalid memory access in sharpsl_save_param()
  2013-07-20 23:07 [PATCH] pxa: sharpsl_param: fix invalid memory access in sharpsl_save_param() Andrea Adami
@ 2013-08-22 11:38 ` Andrea Adami
  0 siblings, 0 replies; 2+ messages in thread
From: Andrea Adami @ 2013-08-22 11:38 UTC (permalink / raw)
  To: linux-arm-kernel

I'm bumping this after one month.
Will, I put you in copy because you did some observations about the
patch last time and you seemingly committe the change which broke boot
of sharpsl devices.

Is there something wrong with it?

Thanks

Andrea


Was:

Devices that call sharpsl_save_param() will hang on boot due to
a memcpy call that uses physical addresses that are no longer
valid. This is caused by the following commit:

commit 72662e01088394577be4a3f14da94cf87bea2591
Author: Will Deacon <will.deacon@arm.com>
Date:   Wed Nov 23 12:03:27 2011 +0000

ARM: head.S: only include __turn_mmu_on in the initial identity mapping




---------- Forwarded message ----------
From: Andrea Adami <andrea.adami@gmail.com>
Date: Sun, Jul 21, 2013 at 1:07 AM
Subject: [PATCH] pxa: sharpsl_param: fix invalid memory access in
sharpsl_save_param()
To: linux-arm-kernel at lists.infradead.org
Cc: Russell King <linux@arm.linux.org.uk>,
linux-kernel at vger.kernel.org, Marko Katic <dromede@gmail.com>


From: Marko Katic <dromede@gmail.com>

Unbreak kernel boot (tested with kexecboot)

Patch was sent twice upstrream:
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-December/137284.html
Devices that call sharpsl_save_param() will hang on boot due to
a memcpy call that uses a physical address that is no longer * accessible. Fix
his by converting the physical address into a virtual one.

Signed-off-by: Marko Katic <dromede@gmail.com>
[andrea.adami at gmail.com: checkpatch.pl dislikes void * param_start]
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
---
 arch/arm/common/sharpsl_param.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/common/sharpsl_param.c b/arch/arm/common/sharpsl_param.c
index d56c932..b70b13a 100644
--- a/arch/arm/common/sharpsl_param.c
+++ b/arch/arm/common/sharpsl_param.c
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/string.h>
+#include <asm/memory.h>
 #include <asm/mach/sharpsl_param.h>

 /*
@@ -41,7 +42,8 @@ EXPORT_SYMBOL(sharpsl_param);

 void sharpsl_save_param(void)
 {
-       memcpy(&sharpsl_param, (void *)PARAM_BASE, sizeof(struct
sharpsl_param_info));
+       void *param_start = phys_to_virt(PARAM_BASE);
+       memcpy(&sharpsl_param, param_start, sizeof(struct sharpsl_param_info));

        if (sharpsl_param.comadj_keyword != COMADJ_MAGIC)
                sharpsl_param.comadj=-1;
--
1.8.1.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-22 11:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-20 23:07 [PATCH] pxa: sharpsl_param: fix invalid memory access in sharpsl_save_param() Andrea Adami
2013-08-22 11:38 ` Andrea Adami

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).