diff options
Diffstat (limited to 'kernel/module')
-rw-r--r-- | kernel/module/main.c | 6 | ||||
-rw-r--r-- | kernel/module/stats.c | 11 |
2 files changed, 10 insertions, 7 deletions
diff --git a/kernel/module/main.c b/kernel/module/main.c index 01fffa8afef2..044aa2c9e3cb 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2813,7 +2813,11 @@ static int early_mod_check(struct load_info *info, int flags) if (err) return err; - return 0; + mutex_lock(&module_mutex); + err = module_patient_check_exists(info->mod->name, FAIL_DUP_MOD_BECOMING); + mutex_unlock(&module_mutex); + + return err; } /* diff --git a/kernel/module/stats.c b/kernel/module/stats.c index 3d45744b3920..1d31f96a5e28 100644 --- a/kernel/module/stats.c +++ b/kernel/module/stats.c @@ -85,7 +85,7 @@ * calls: * * a) FAIL_DUP_MOD_BECOMING: at the end of early_mod_check() before - * layout_and_allocate(). This does not yet happen. + * layout_and_allocate(). * - with module decompression: 2 virtual memory allocation calls * - without module decompression: 1 virtual memory allocation calls * b) FAIL_DUP_MOD_LOAD: after layout_and_allocate() on add_unformed_module() @@ -126,17 +126,16 @@ static LIST_HEAD(dup_failed_modules); * pressure. * * invalid_becoming_bytes: total number of bytes allocated and freed used * used to read the kernel module userspace wants us to read before we - * promote it to be processed to be added to our @modules linked list. - * These failures could in theory happen if we had a check in - * between a successful kernel_read_file_from_fd() + * promote it to be processed to be added to our @modules linked list. These + * failures can happen if we had a check in between a successful kernel_read_file_from_fd() * call and right before we allocate the our private memory for the module * which would be kept if the module is successfully loaded. The most common * reason for this failure is when userspace is racing to load a module * which it does not yet see loaded. The first module to succeed in * add_unformed_module() will add a module to our &modules list and * subsequent loads of modules with the same name will error out at the - * end of early_mod_check(). A check for module_patient_check_exists() - * at the end of early_mod_check() could be added to prevent duplicate allocations + * end of early_mod_check(). The check for module_patient_check_exists() + * at the end of early_mod_check() prevents duplicate allocations * on layout_and_allocate() for modules already being processed. These * duplicate failed modules are non-fatal, however they typically are * indicative of userspace not seeing a module in userspace loaded yet and |