kern/135485: During a shutdown, kernel modules should be unloaded in reverse order in which they where loaded

Nima Misaghian nmisaghian at sandvine.com
Thu Jun 11 20:50:05 UTC 2009


>Number:         135485
>Category:       kern
>Synopsis:       During a shutdown, kernel modules should be unloaded in reverse order in which they where loaded
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 11 20:50:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Nima Misaghian
>Release:        6.1
>Organization:
Sandvine
>Environment:
>Description:
During a shutdown, kernel modules should be unloaded in reverse order in which they where loaded. Otherwise, modules that other modules depend on are unloaded first, which could cause problems. 

>How-To-Repeat:

>Fix:
src/sys/kern/kern_module.c


< typedef TAILQ_HEAD(modulelist, module) modulelist_t;
> typedef TAILQ_HEAD(, module) modulelist_t;


static void
module_shutdown(void *arg1, int arg2)
{
	module_t mod;

	if (arg2 & RB_NOSYNC)
		return;
	MOD_SLOCK;
<	TAILQ_FOREACH_REVERSE(mod, &modules, modulelist, link)
>       TAILQ_FOREACH(mod, &modules, link)
		MOD_EVENT(mod, MOD_SHUTDOWN);
	MOD_SUNLOCK;
}


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list