Skip to content
This repository has been archived by the owner on May 28, 2021. It is now read-only.

Commit

Permalink
module: set MODULE_STATE_GOING state when a module fails to load
Browse files Browse the repository at this point in the history
[ Upstream commit 5e8ed280dab9eeabc1ba0b2db5dbe9fe6debb6b5 ]

If a module fails to load due to an error in prepare_coming_module(),
the following error handling in load_module() runs with
MODULE_STATE_COMING in module's state. Fix it by correctly setting
MODULE_STATE_GOING under "bug_cleanup" label.

Signed-off-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
mirab authored and gregkh committed Jan 9, 2021
1 parent c1fcb6d commit 49ccaee
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -3738,6 +3738,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
MODULE_STATE_GOING, mod);
klp_module_going(mod);
bug_cleanup:
mod->state = MODULE_STATE_GOING;
/* module_bug_cleanup needs module_mutex protection */
mutex_lock(&module_mutex);
module_bug_cleanup(mod);
Expand Down

0 comments on commit 49ccaee

Please sign in to comment.