* [PATCH 1/1] module: Fix dangling pointer after kfree()
@ 2011-11-15 1:58 Dominic Chen
0 siblings, 0 replies; only message in thread
From: Dominic Chen @ 2011-11-15 1:58 UTC (permalink / raw)
To: linux-kernel; +Cc: rusty
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().
Signed-off-by: Dominic Chen <d.c.ddcc@gmail.com>
---
kernel/module.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/kernel/module.c b/kernel/module.c
index 178333c..9ca0923 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -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
--
1.7.5.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-11-15 1:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-15 1:58 [PATCH 1/1] module: Fix dangling pointer after kfree() Dominic Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).