Failures inside codetag_load_module() are currently ignored. As a result an error there would not cause a module load failure and freeing of the associated resources. Correct this behavior by propagating the error code to the caller and handling possible errors. With this change, error to allocate percpu counters, which happens at this stage, will not be ignored and will cause a module load failure and freeing of resources. With this change we also do not need to disable memory allocation profiling when this error happens, instead we fail to load the module.
Showing the changes to kernel/module (1 of 4 files). Show all
Unified · Split
| @@ -3386,11 +3386,12 @@ static int load_module(struct load_info *info, const char __user *uargs, · 3385 unmodified lines | ||
| 3386 | 3386 | goto sysfs_cleanup; |
| 3387 | 3387 | } |
| 3388 | 3388 | |
| 3389 | + if (codetag_load_module(mod)) | |
| 3390 | + goto sysfs_cleanup; | |
| 3391 | + | |
| 3389 | 3392 | /* Get rid of temporary copy. */ |
| 3390 | 3393 | free_copy(info, flags); |
| 3391 | 3394 | |
| 3392 | − codetag_load_module(mod); | |
| 3393 | − | |
| 3394 | 3395 | /* Done! */ |
| 3395 | 3396 | trace_module_load(mod); |
| 3396 | 3397 | |