The move of the module sanity check to earlier skipped the audit logging call in the case of failure and to a place where the previously used context is unavailable. Add an audit logging call for the module loading failure case and get the module name when possible.
Showing the changes to kernel/module (1 of 4 files). Show all
Unified · Split
| @@ -3368,7 +3368,7 @@ static int load_module(struct load_info *info, const char __user *uargs, · 3367 unmodified lines | ||
| 3368 | 3368 | |
| 3369 | 3369 | module_allocated = true; |
| 3370 | 3370 | |
| 3371 | − audit_log_kern_module(mod->name); | |
| 3371 | + audit_log_kern_module(info->name); | |
| 3372 | 3372 | |
| 3373 | 3373 | /* Reserve our place in the list. */ |
| 3374 | 3374 | err = add_unformed_module(mod); |
| @@ -3532,8 +3532,10 @@ static int load_module(struct load_info *info, const char __user *uargs, · 157 unmodified lines | ||
| 3532 | 3532 | * failures once the proper module was allocated and |
| 3533 | 3533 | * before that. |
| 3534 | 3534 | */ |
| 3535 | − if (!module_allocated) | |
| 3535 | + if (!module_allocated) { | |
| 3536 | + audit_log_kern_module(info->name ? info->name : "?"); | |
| 3536 | 3537 | mod_stat_bump_becoming(info, flags); |
| 3538 | + } | |
| 3537 | 3539 | free_copy(info, flags); |
| 3538 | 3540 | return err; |
| 3539 | 3541 | } |