Skip to contentSkip to conversation

module: Fix dangling pointer after kfree()

PATCH New Dominic Chen 1 participant 1 message Nov 15, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 module: Fix dangling pointer after kfree()

remove_notes_attrs() calls free_notes_attrs(), which in turn calls kfree() on mod->notes_attrs, but fails to set this dangling pointer to NULL. This differs from both module_param_sysfs_remove() and remove_sect_attrs(), which set the pointers to NULL after calling kfree().

---
 kernel/module.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
kernel/module.c +0 -0
index 178333c..9ca0923 100644
@@ -1380,8 +1380,10 @@ static void add_notes_attrs(struct module *mod,

const struct load_info *info)

static void remove_notes_attrs(struct module *mod)
{
- if (mod->notes_attrs)
+ if (mod->notes_attrs) {
free_notes_attrs(mod->notes_attrs, mod->notes_attrs->notes);
+ mod->notes_attrs = NULL;
+ }
}

#else

Signature · 1 line
1.7.5.4