[Cbe-oss-dev] [PATCH 2/2] libspe2: Fix EA space leak in spe_image_open

Kazunori Asayama asayama at sm.sony.co.jp
Thu Apr 24 18:59:36 EST 2008


This patch fixes an effective address space leak in spe_image_open
when an invalid ELF image is passed.

Signed-off-by: Kazunori Asayama <asayama at sm.sony.co.jp>
---
 spebase/image.c |    3 +++
 1 file changed, 3 insertions(+)

Index: b/spebase/image.c
===================================================================
--- a/spebase/image.c	2008-04-22 11:39:10.000000000 +0900
+++ b/spebase/image.c	2008-04-22 15:55:40.000000000 +0900
@@ -46,6 +46,7 @@ spe_program_handle_t *_base_spe_image_op
 	if (!ret)
 		return NULL;
 
+	ret->speh.elf_image = MAP_FAILED;
 	ret->speh.handle_size = sizeof(spe_program_handle_t);
 	ret->speh.toe_shadow = NULL;
 
@@ -86,6 +87,8 @@ spe_program_handle_t *_base_spe_image_op
 
 	/* err & cleanup */
 ret_err:
+	if (ret->speh.elf_image != MAP_FAILED)
+		munmap(ret->speh.elf_image, ret->map_size);
 	if (binfd >= 0)
 		close(binfd);
 




More information about the cbe-oss-dev mailing list