From 52db2a960277bf8b0e90320f6394da1d54bb553c Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 19 Jan 2004 05:08:26 -0800 Subject: [PATCH] [PATCH] module removal race fix From: Rusty Russell Vatsa spotted this: you can remove a module while it's being initialized, and that will be bad. Hole was opened when I dropped the sem around the init routine (which can probe for other modules). --- kernel/module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index 65f82a3278dd7..f3113ff198187 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -687,8 +687,8 @@ sys_delete_module(const char __user *name_user, unsigned int flags) goto out; } - /* Already dying? */ - if (mod->state == MODULE_STATE_GOING) { + /* Doing init or already dying? */ + if (mod->state != MODULE_STATE_LIVE) { /* FIXME: if (force), slam module count and wake up waiter --RR */ DEBUGP("%s already dying\n", mod->name); -- 2.53.0