]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/module.c
Staging: add TAINT_CRAP for all drivers/staging code
[linux-2.6-omap-h63xx.git] / kernel / module.c
index 61d212120df48e82a1b6521120fdbd428d983a81..152b1655bbaccaf977911ba985847e41ef28b236 100644 (file)
@@ -1799,13 +1799,14 @@ static void *module_alloc_update_bounds(unsigned long size)
 
 /* Allocate and load the module: note that size of section 0 is always
    zero, and we rely on this for optional sections. */
-static struct module *load_module(void __user *umod,
+static noinline struct module *load_module(void __user *umod,
                                  unsigned long len,
                                  const char __user *uargs)
 {
        Elf_Ehdr *hdr;
        Elf_Shdr *sechdrs;
        char *secstrings, *args, *modmagic, *strtab = NULL;
+       char *staging;
        unsigned int i;
        unsigned int symindex = 0;
        unsigned int strindex = 0;
@@ -1960,6 +1961,14 @@ static struct module *load_module(void __user *umod,
                goto free_hdr;
        }
 
+       staging = get_modinfo(sechdrs, infoindex, "staging");
+       if (staging) {
+               add_taint_module(mod, TAINT_CRAP);
+               printk(KERN_WARNING "%s: module is from the staging directory,"
+                      " the quality is unknown, you have been warned.\n",
+                      mod->name);
+       }
+
        /* Now copy in args */
        args = strndup_user(uargs, ~0UL >> 1);
        if (IS_ERR(args)) {
@@ -2288,7 +2297,7 @@ sys_init_module(void __user *umod,
 
        /* Start the module */
        if (mod->init != NULL)
-               ret = mod->init();
+               ret = do_one_initcall(mod->init);
        if (ret < 0) {
                /* Init routine failed: abort.  Try to protect us from
                    buggy refcounters. */
@@ -2556,6 +2565,8 @@ static char *module_flags(struct module *mod, char *buf)
                        buf[bx++] = 'P';
                if (mod->taints & TAINT_FORCED_MODULE)
                        buf[bx++] = 'F';
+               if (mod->taints & TAINT_CRAP)
+                       buf[bx++] = 'C';
                /*
                 * TAINT_FORCED_RMMOD: could be added.
                 * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't