Re: [PATCH] mii module broken under new scheme

From: Rusty Russell (rusty@rustcorp.com.au)
Date: Tue Nov 19 2002 - 17:23:01 EST


Linus, this is a better fix, until the module post-link patch goes in
(rth and I are working on it, Kai likes the idea for other reasons).

Once again, fix up my assumptions so we err on the side of not
breaking anything.

Untested (on plane home and low on battery), but trivial.

Hope this helps,
Rusty.

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5-bk/kernel/module.c working-2.5-bk-modname/kernel/module.c --- linux-2.5-bk/kernel/module.c 2002-11-20 05:58:00.000000000 +1100 +++ working-2.5-bk-modname/kernel/module.c 2002-11-20 09:18:04.000000000 +1100 @@ -895,12 +895,6 @@ static struct module *load_module(void * #endif } - if (!modnameindex) { - DEBUGP("Module has no name!\n"); - err = -ENOEXEC; - goto free_hdr; - } - /* Now allocate space for the module proper, and copy name and args. */ err = strlen_user(uargs); if (err < 0) @@ -917,8 +911,17 @@ static struct module *load_module(void * err = -EFAULT; goto free_mod; } - strncpy(mod->name, (char *)hdr + sechdrs[modnameindex].sh_offset, - sizeof(mod->name)-1); + + if (modnameindex) + strncpy(mod->name, + (char *)hdr + sechdrs[modnameindex].sh_offset, + sizeof(mod->name)-1); + else { + /* FIXME: With module post-link phase, always insert + .modname section. --RR */ + static unsigned int num_unknown; + sprintf(mod->name, "unknown%u", num_unknown++); + } if (find_module(mod->name)) { err = -EEXIST; - 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/



This archive was generated by hypermail 2b29 : Sat Nov 23 2002 - 22:00:31 EST