* [U-Boot] [PATCH] bootm: fix size arg of flush_cache() in bootm_load_os().
@ 2016-01-20 8:37 Purna Chandra Mandal
2016-01-20 20:26 ` Simon Glass
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Purna Chandra Mandal @ 2016-01-20 8:37 UTC (permalink / raw)
To: u-boot
Variable _load_end_ points to end address of uncompressed buffer
(*not* uncomress_buffer_end / sizeof(ulong)), so multipling uncompressed
size with sizeof(ulong) is grossly incorrect in flush_cache().
It might lead to access of address beyond valid memory range and hang the CPU.
Tested on MIPS architecture by using compressed(gzip, lzma)
and uncompressed uImage.
Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
---
common/bootm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/bootm.c b/common/bootm.c
index 58936ca..99d574d 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -435,7 +435,7 @@ static int bootm_load_os(bootm_headers_t *images, unsigned long *load_end,
bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE);
return err;
}
- flush_cache(load, (*load_end - load) * sizeof(ulong));
+ flush_cache(load, *load_end - load);
debug(" kernel loaded at 0x%08lx, end = 0x%08lx\n", load, *load_end);
bootstage_mark(BOOTSTAGE_ID_KERNEL_LOADED);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] bootm: fix size arg of flush_cache() in bootm_load_os().
2016-01-20 8:37 [U-Boot] [PATCH] bootm: fix size arg of flush_cache() in bootm_load_os() Purna Chandra Mandal
@ 2016-01-20 20:26 ` Simon Glass
2016-01-21 15:34 ` Daniel Schwierzeck
2016-01-25 21:28 ` [U-Boot] " Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2016-01-20 20:26 UTC (permalink / raw)
To: u-boot
On 20 January 2016 at 01:37, Purna Chandra Mandal
<purna.mandal@microchip.com> wrote:
> Variable _load_end_ points to end address of uncompressed buffer
> (*not* uncomress_buffer_end / sizeof(ulong)), so multipling uncompressed
> size with sizeof(ulong) is grossly incorrect in flush_cache().
> It might lead to access of address beyond valid memory range and hang the CPU.
>
> Tested on MIPS architecture by using compressed(gzip, lzma)
> and uncompressed uImage.
>
> Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
> ---
>
> common/bootm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] bootm: fix size arg of flush_cache() in bootm_load_os().
2016-01-20 8:37 [U-Boot] [PATCH] bootm: fix size arg of flush_cache() in bootm_load_os() Purna Chandra Mandal
2016-01-20 20:26 ` Simon Glass
@ 2016-01-21 15:34 ` Daniel Schwierzeck
2016-01-25 21:28 ` [U-Boot] " Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Schwierzeck @ 2016-01-21 15:34 UTC (permalink / raw)
To: u-boot
Am Mittwoch, den 20.01.2016, 14:07 +0530 schrieb Purna Chandra Mandal:
> Variable _load_end_ points to end address of uncompressed buffer
> (*not* uncomress_buffer_end / sizeof(ulong)), so multipling
> uncompressed
> size with sizeof(ulong) is grossly incorrect in flush_cache().
> It might lead to access of address beyond valid memory range and hang
> the CPU.
>
> Tested on MIPS architecture by using compressed(gzip, lzma)
> and uncompressed uImage.
>
> Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> ---
>
> common/bootm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/bootm.c b/common/bootm.c
> index 58936ca..99d574d 100644
> --- a/common/bootm.c
> +++ b/common/bootm.c
> @@ -435,7 +435,7 @@ static int bootm_load_os(bootm_headers_t *images,
> unsigned long *load_end,
> bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE);
> return err;
> }
> - flush_cache(load, (*load_end - load) * sizeof(ulong));
> + flush_cache(load, *load_end - load);
>
> debug(" kernel loaded at 0x%08lx, end = 0x%08lx\n", load,
> *load_end);
> bootstage_mark(BOOTSTAGE_ID_KERNEL_LOADED);
--
- Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] bootm: fix size arg of flush_cache() in bootm_load_os().
2016-01-20 8:37 [U-Boot] [PATCH] bootm: fix size arg of flush_cache() in bootm_load_os() Purna Chandra Mandal
2016-01-20 20:26 ` Simon Glass
2016-01-21 15:34 ` Daniel Schwierzeck
@ 2016-01-25 21:28 ` Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2016-01-25 21:28 UTC (permalink / raw)
To: u-boot
On Wed, Jan 20, 2016 at 02:07:39PM +0530, Purna Chandra Mandal wrote:
> Variable _load_end_ points to end address of uncompressed buffer
> (*not* uncomress_buffer_end / sizeof(ulong)), so multipling uncompressed
> size with sizeof(ulong) is grossly incorrect in flush_cache().
> It might lead to access of address beyond valid memory range and hang the CPU.
>
> Tested on MIPS architecture by using compressed(gzip, lzma)
> and uncompressed uImage.
>
> Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160125/955e186f/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-25 21:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-20 8:37 [U-Boot] [PATCH] bootm: fix size arg of flush_cache() in bootm_load_os() Purna Chandra Mandal
2016-01-20 20:26 ` Simon Glass
2016-01-21 15:34 ` Daniel Schwierzeck
2016-01-25 21:28 ` [U-Boot] " Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox