lkml.org 
[lkml]   [2006]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: 2.6.17-mm3: segvs in modpost with out-of-tree modules
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 <jeremy@goop.org> 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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-07-02 00:07    [W:0.657 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site