[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4EC1C730.2050000@gmail.com>
Date: Mon, 14 Nov 2011 18:58:08 -0700
From: Dominic Chen <d.c.ddcc@...il.com>
To: linux-kernel@...r.kernel.org
CC: rusty@...tcorp.com.au
Subject: [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().
Signed-off-by: Dominic Chen <d.c.ddcc@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists