Re: 2.6.17-mm3: segvs in modpost with out-of-tree modules

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

 



On Wed, Jun 28, 2006 at 11:44:20AM -0700, Jeremy Fitzhardinge wrote:
> Andrew Morton wrote:
> >On Wed, 28 Jun 2006 09:51:11 -0700
> >Jeremy Fitzhardinge <[email protected]> wrote:
> >  
> >>I haven't really looked at yet, but I was hoping someone had already 
> >>tracked it down.
> >>    
> >
> >Not that I'm aware of.
> 
> OK, it wasn't really a bug; I had an old Modules.symvers lying around 
> the madwifi tree from a previous build against an earlier kernel.  But 
> modpost seems all pretty fragile...

I have pushed following patch that fixes the SEGV. We shoul not SEGV no
matter the input.


	Sam

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index d03c9ff..37e34d6 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -205,6 +205,8 @@ static const char *export_str(enum expor
 static enum export export_no(const char * s)
 {
 	int i;
+	if (!s)
+		return export_unknown;
 	for (i = 0; export_list[i].export != export_unknown; i++) {
 		if (strcmp(export_list[i].str, s) == 0)
 			return export_list[i].export;
@@ -1265,7 +1267,7 @@ static void write_if_changed(struct buff
 }
 
 /* parse Module.symvers file. line format:
- * 0x12345678<tab>symbol<tab>module[<tab>export]
+ * 0x12345678<tab>symbol<tab>module[[<tab>export]<tab>something]
  **/
 static void read_dump(const char *fname, unsigned int kernel)
 {
@@ -1278,7 +1280,7 @@ static void read_dump(const char *fname,
 		return;
 
 	while ((line = get_next_line(&pos, file, size))) {
-		char *symname, *modname, *d, *export;
+		char *symname, *modname, *d, *export, *end;
 		unsigned int crc;
 		struct module *mod;
 		struct symbol *s;
@@ -1291,7 +1293,8 @@ static void read_dump(const char *fname,
 		*modname++ = '\0';
 		if ((export = strchr(modname, '\t')) != NULL)
 			*export++ = '\0';
-
+		if (export && ((end = strchr(export, '\t')) != NULL))
+			*end = '\0';
 		crc = strtoul(line, &d, 16);
 		if (*symname == '\0' || *modname == '\0' || *d != '\0')
 			goto fail;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux