[v3,1/4] module: Correct wake up of module_wq
Commit Message
The module_wq wait queue has only non-exclusive waiters and all waits
are interruptible, therefore for consistency use wake_up_interruptible()
to wake its waiters.
Suggested-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
---
kernel/module/main.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Comments
On 16.10.22 14:30, Petr Pavlu wrote:
> The module_wq wait queue has only non-exclusive waiters and all waits
> are interruptible, therefore for consistency use wake_up_interruptible()
> to wake its waiters.
>
> Suggested-by: Petr Mladek <pmladek@suse.com>
> Reviewed-by: Petr Mladek <pmladek@suse.com>
> Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
> ---
> kernel/module/main.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/module/main.c b/kernel/module/main.c
> index d02d39c7174e..a12e177ea81f 100644
> --- a/kernel/module/main.c
> +++ b/kernel/module/main.c
> @@ -764,7 +764,7 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
>
> free_module(mod);
> /* someone could wait for the module in add_unformed_module() */
> - wake_up_all(&module_wq);
> + wake_up_interruptible(&module_wq);
> return 0;
> out:
> mutex_unlock(&module_mutex);
> @@ -2522,7 +2522,7 @@ static noinline int do_init_module(struct module *mod)
> schedule_work(&init_free_wq);
>
> mutex_unlock(&module_mutex);
> - wake_up_all(&module_wq);
> + wake_up_interruptible(&module_wq);
>
> return 0;
>
> @@ -2538,7 +2538,7 @@ static noinline int do_init_module(struct module *mod)
> klp_module_going(mod);
> ftrace_release_mod(mod);
> free_module(mod);
> - wake_up_all(&module_wq);
> + wake_up_interruptible(&module_wq);
> return ret;
> }
>
> @@ -2879,7 +2879,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
> /* Unlink carefully: kallsyms could be walking list. */
> list_del_rcu(&mod->list);
> mod_tree_remove(mod);
> - wake_up_all(&module_wq);
> + wake_up_interruptible(&module_wq);
> /* Wait for RCU-sched synchronizing before releasing mod->list. */
> synchronize_rcu();
> mutex_unlock(&module_mutex);
Reviewed-by: David Hildenbrand <david@redhat.com>
@@ -764,7 +764,7 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
free_module(mod);
/* someone could wait for the module in add_unformed_module() */
- wake_up_all(&module_wq);
+ wake_up_interruptible(&module_wq);
return 0;
out:
mutex_unlock(&module_mutex);
@@ -2522,7 +2522,7 @@ static noinline int do_init_module(struct module *mod)
schedule_work(&init_free_wq);
mutex_unlock(&module_mutex);
- wake_up_all(&module_wq);
+ wake_up_interruptible(&module_wq);
return 0;
@@ -2538,7 +2538,7 @@ static noinline int do_init_module(struct module *mod)
klp_module_going(mod);
ftrace_release_mod(mod);
free_module(mod);
- wake_up_all(&module_wq);
+ wake_up_interruptible(&module_wq);
return ret;
}
@@ -2879,7 +2879,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
/* Unlink carefully: kallsyms could be walking list. */
list_del_rcu(&mod->list);
mod_tree_remove(mod);
- wake_up_all(&module_wq);
+ wake_up_interruptible(&module_wq);
/* Wait for RCU-sched synchronizing before releasing mod->list. */
synchronize_rcu();
mutex_unlock(&module_mutex);