|
@@ -3096,6 +3096,32 @@ static int may_init_module(void)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * Can't use wait_event_interruptible() because our condition
|
|
|
|
+ * 'finished_loading()' contains a blocking primitive itself (mutex_lock).
|
|
|
|
+ */
|
|
|
|
+static int wait_finished_loading(struct module *mod)
|
|
|
|
+{
|
|
|
|
+ DEFINE_WAIT_FUNC(wait, woken_wake_function);
|
|
|
|
+ int ret = 0;
|
|
|
|
+
|
|
|
|
+ add_wait_queue(&module_wq, &wait);
|
|
|
|
+ for (;;) {
|
|
|
|
+ if (finished_loading(mod->name))
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ if (signal_pending(current)) {
|
|
|
|
+ ret = -ERESTARTSYS;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
|
|
|
|
+ }
|
|
|
|
+ remove_wait_queue(&module_wq, &wait);
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* We try to place it in the list now to make sure it's unique before
|
|
* We try to place it in the list now to make sure it's unique before
|
|
* we dedicate too many resources. In particular, temporary percpu
|
|
* we dedicate too many resources. In particular, temporary percpu
|
|
@@ -3116,8 +3142,8 @@ again:
|
|
|| old->state == MODULE_STATE_UNFORMED) {
|
|
|| old->state == MODULE_STATE_UNFORMED) {
|
|
/* Wait in case it fails to load. */
|
|
/* Wait in case it fails to load. */
|
|
mutex_unlock(&module_mutex);
|
|
mutex_unlock(&module_mutex);
|
|
- err = wait_event_interruptible(module_wq,
|
|
|
|
- finished_loading(mod->name));
|
|
|
|
|
|
+
|
|
|
|
+ err = wait_finished_loading(mod);
|
|
if (err)
|
|
if (err)
|
|
goto out_unlocked;
|
|
goto out_unlocked;
|
|
goto again;
|
|
goto again;
|