[PATCH 2/2] elfops: fix potential crashing bug in load_symbols()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



get_section() returned an undefined section size on failure,
which could cause load_symbols() to crash if kernel symtables
were missing from the module.

get_section() will now return secsize == 0 if it fails.

Signed-off-by: Andreas Robinson <andr345@xxxxxxxxx>
---
 elfops_core.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/elfops_core.c b/elfops_core.c
index 1e8083b..051e7f7 100644
--- a/elfops_core.c
+++ b/elfops_core.c
@@ -36,6 +36,8 @@ static void *PERBIT(get_section)(struct elf_file *module,
 	const char *secnames;
 	unsigned int i;
 
+	*secsize = 0;
+
 	if (len <= 0 || len < sizeof(*hdr))
 		return NULL;
 
@@ -65,7 +67,6 @@ static void *PERBIT(get_section)(struct elf_file *module,
 			return data + secoffset;
 		}
 	}
-	*secsize = 0;
 	return NULL;
 }
 
-- 
1.6.0.4


--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux