diff options
author | Robert Jarzmik <rjarzmik@free.fr> | 2008-05-02 16:17:06 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-05-04 06:06:05 -0400 |
commit | 649de51b883746d76c5fa1614dd067054c9d702a (patch) | |
tree | 68c3b172063bdf4cc82a727d3d4ca48f63487665 /arch/arm/mach-pxa/pm.c | |
parent | c8df9a53e8d16877fc0b268b002af2a47a14643a (diff) |
[ARM] 5027/1: Fixed random memory corruption on pxa suspend cycle.
Each time a pxa type cpu went in suspend, a portion of
kmalloc memory was corrupted.
The issue was an incorrect length allocation introduced by
the commit 711be5ccfe9a02ba560aa918a008c31ea4760163 for
the save registers array (=> overflow).
Signed-off-by: Robert Jarzmik <rjarzmik@free.fr>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa/pm.c')
-rw-r--r-- | arch/arm/mach-pxa/pm.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c index ec1bbf333a3a..329df2152dcd 100644 --- a/arch/arm/mach-pxa/pm.c +++ b/arch/arm/mach-pxa/pm.c | |||
@@ -42,7 +42,7 @@ int pxa_pm_enter(suspend_state_t state) | |||
42 | if (state != PM_SUSPEND_STANDBY) { | 42 | if (state != PM_SUSPEND_STANDBY) { |
43 | pxa_cpu_pm_fns->save(sleep_save); | 43 | pxa_cpu_pm_fns->save(sleep_save); |
44 | /* before sleeping, calculate and save a checksum */ | 44 | /* before sleeping, calculate and save a checksum */ |
45 | for (i = 0; i < pxa_cpu_pm_fns->save_size - 1; i++) | 45 | for (i = 0; i < pxa_cpu_pm_fns->save_count - 1; i++) |
46 | sleep_save_checksum += sleep_save[i]; | 46 | sleep_save_checksum += sleep_save[i]; |
47 | } | 47 | } |
48 | 48 | ||
@@ -55,7 +55,7 @@ int pxa_pm_enter(suspend_state_t state) | |||
55 | 55 | ||
56 | if (state != PM_SUSPEND_STANDBY) { | 56 | if (state != PM_SUSPEND_STANDBY) { |
57 | /* after sleeping, validate the checksum */ | 57 | /* after sleeping, validate the checksum */ |
58 | for (i = 0; i < pxa_cpu_pm_fns->save_size - 1; i++) | 58 | for (i = 0; i < pxa_cpu_pm_fns->save_count - 1; i++) |
59 | checksum += sleep_save[i]; | 59 | checksum += sleep_save[i]; |
60 | 60 | ||
61 | /* if invalid, display message and wait for a hardware reset */ | 61 | /* if invalid, display message and wait for a hardware reset */ |
@@ -101,7 +101,8 @@ static int __init pxa_pm_init(void) | |||
101 | return -EINVAL; | 101 | return -EINVAL; |
102 | } | 102 | } |
103 | 103 | ||
104 | sleep_save = kmalloc(pxa_cpu_pm_fns->save_size, GFP_KERNEL); | 104 | sleep_save = kmalloc(pxa_cpu_pm_fns->save_count * sizeof(unsigned long), |
105 | GFP_KERNEL); | ||
105 | if (!sleep_save) { | 106 | if (!sleep_save) { |
106 | printk(KERN_ERR "failed to alloc memory for pm save\n"); | 107 | printk(KERN_ERR "failed to alloc memory for pm save\n"); |
107 | return -ENOMEM; | 108 | return -ENOMEM; |