commit 82189b9807e05ea8d1f69de5bf92eaf244a0eb12
tree ecc6f1cf933a249ea1a9a9858a7a90878ec4162b
parent 533221fbaf001692d5db646f84f7d033fac78cc7
author Catalin Marinas <[EMAIL PROTECTED]> 1164481770 -0800
committer Linus Torvalds <[EMAIL PROTECTED]> 1164490113 -0800

[PATCH] Fix device_attribute memory leak in device_del

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 <[EMAIL PROTECTED]>
Acked-by: Greg KH <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 drivers/base/core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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)
-       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);
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to