kmod/core: kpatch_unregister return error if !kpmod->enabled

It's probably cleaner to just return -EINVAL if the kpmod isn't enabled,
instead of warning and continuing, which would be dangerous.

I think the reason I had it WARN before is because this condition
shouldn't be possible given the source for the patch module.  But the
core module can't necessarily assume that it's our trustworthy patch
module code on the other side.
This commit is contained in:
Josh Poimboeuf 2014-05-02 22:59:20 -05:00
parent 4bde6c3bbf
commit 6ee8803978
1 changed files with 2 additions and 1 deletions

View File

@ -543,7 +543,8 @@ int kpatch_unregister(struct kpatch_module *kpmod)
int num_funcs = kpmod->num_funcs;
int i, ret;
WARN_ON(!kpmod->enabled);
if (!kpmod->enabled)
return -EINVAL;
down(&kpatch_mutex);