[PATCH] Module w/o cleanup function causes GPF on rmmod

=?ISO-8859-1?Q?I=F1aky_P=E9rez_Gonz=E1lez?= (inaky@peloncho.fis.ucm.es)
Sun, 28 Dec 1997 18:13:11 +0100


Hi

While coding one of the USB modules, I forgot to alias the
cleanup_module function and got GPFs. This was caused on the unloading
code in kernel/module.c, which doesn't check if the `cleanup' member
of the struct module is not NULL.

This simple patch adds a check for it. Perhaps it'd we worth
to add a KERN_WARNING printk, as not having a cleanup_module()
function is not something that should be correct :).

Happy New Year

--- linux/kernel/module.c~ Tue Dec 23 22:35:48 1997
+++ linux/kernel/module.c Sun Dec 28 17:58:13 1997
@@ -773,7 +773,8 @@

mod->flags |= MOD_DELETED;
if (mod->flags & MOD_RUNNING) {
- mod->cleanup();
+ if (mod->cleanup)
+ mod->cleanup();
mod->flags &= ~MOD_RUNNING;
}

-- 

Linux-USB! http://peloncho.fis.ucm.es/~inaky/USB.html - - Inaky Perez Gonzalez -- PGP pubkey fingerprint - inaky@peloncho.fis.ucm.es -- 8E 34 3A 62 64 99 E2 44 - http://peloncho.fis.ucm.es/~inaky -- AD 7B 30 D9 DD FF 3E 4C - --------------------------------- -- ----------------------- - The loneliness of the long distance runner .....