* [PATCH 2.6.19-rc6] Fix device_attribute memory leak in device_del
@ 2006-11-18 22:42 Catalin Marinas
0 siblings, 0 replies; only message in thread
From: Catalin Marinas @ 2006-11-18 22:42 UTC (permalink / raw)
To: linux-kernel; +Cc: Greg Kroah-Hartman
dev->devt_attr is allocated in device_add() but it is never freed in
device_del() in the drivers/base/core.c file (reported by kmemleak).
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
I sent this patch before for 2.6.18 but it probably got lost. Anyway,
I found the bug again while testing kmemleak.
drivers/base/core.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 68ad11a..002fde4 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -591,8 +591,10 @@ void device_del(struct device * dev)
if (parent)
klist_del(&dev->knode_parent);
- if (dev->devt_attr)
+ if (dev->devt_attr) {
device_remove_file(dev, dev->devt_attr);
+ kfree(dev->devt_attr);
+ }
if (dev->class) {
sysfs_remove_link(&dev->kobj, "subsystem");
sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2006-11-18 22:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-18 22:42 [PATCH 2.6.19-rc6] Fix device_attribute memory leak in device_del Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox