lkml.org 
[lkml]   [2019]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [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

    \
     
     \ /
      Last update: 2019-06-04 16:16    [W:2.696 / U:0.332 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site