Messages in this thread | | | Date | Tue, 4 Jun 2019 16:15:39 +0200 (CEST) | From | Miroslav Benes <> | Subject | Re: [PATCH v3] kernel/module: Fix mem leak in module_add_modinfo_attrs |
| |
> >> -static void module_remove_modinfo_attrs(struct module *mod) > >> +static void module_remove_modinfo_attrs(struct module *mod, int end) > >> { > >> struct module_attribute *attr; > >> int i; > >> > >> for (i = 0; (attr = &mod->modinfo_attrs[i]); i++) { > >> + if (end >= 0 && i > end) > >> + break; > > > > If end == 0, you break the loop without calling sysfs_remove_file(), which > > is a bug if you called module_remove_modinfo_attrs(mod, 0). > > If end == 0 and i == 0, if statement is false, it won't break the loop.
Eh, you're right of course.
Miroslav
| |